@@ -6,7 +6,6 @@ pub(crate) mod cache;
66pub ( crate ) mod crate_details;
77mod csp;
88pub ( crate ) mod error;
9- mod escaped_uri;
109pub ( crate ) mod extractors;
1110mod features;
1211mod file;
@@ -48,7 +47,6 @@ use docs_rs_types::{BuildStatus, CrateId, KrateName, ReqVersion, Version, Versio
4847use docs_rs_utils:: rustc_version:: parse_rustc_date;
4948use error:: AxumNope ;
5049use page:: TemplateData ;
51- use percent_encoding:: { AsciiSet , CONTROLS , utf8_percent_encode} ;
5250use sentry:: integrations:: tower as sentry_tower;
5351use serde:: Serialize ;
5452use serde_json:: Value ;
@@ -61,19 +59,6 @@ use tower::ServiceBuilder;
6159use tower_http:: { catch_panic:: CatchPanicLayer , timeout:: TimeoutLayer , trace:: TraceLayer } ;
6260use tracing:: { info, instrument} ;
6361
64- // from https://github.com/servo/rust-url/blob/master/url/src/parser.rs
65- // and https://github.com/tokio-rs/axum/blob/main/axum-extra/src/lib.rs
66- const FRAGMENT : & AsciiSet = & CONTROLS . add ( b' ' ) . add ( b'"' ) . add ( b'<' ) . add ( b'>' ) . add ( b'`' ) ;
67- const PATH : & AsciiSet = & FRAGMENT . add ( b'#' ) . add ( b'?' ) . add ( b'{' ) . add ( b'}' ) ;
68-
69- pub ( crate ) fn encode_url_path ( path : & str ) -> String {
70- utf8_percent_encode ( path, PATH ) . to_string ( )
71- }
72-
73- pub ( crate ) fn url_decode < ' a > ( input : & ' a str ) -> Result < Cow < ' a , str > > {
74- Ok ( percent_encoding:: percent_decode ( input. as_bytes ( ) ) . decode_utf8 ( ) ?)
75- }
76-
7762/// Picks the correct "rustdoc.css" static file depending on which rustdoc version was used to
7863/// generate this version of this crate.
7964pub fn get_correct_docsrs_style_file ( version : & str ) -> Result < String > {
@@ -641,8 +626,6 @@ impl_axum_webpage! {
641626
642627#[ cfg( test) ]
643628mod test {
644- use std:: str:: FromStr as _;
645-
646629 use super :: * ;
647630 use crate :: docbuilder:: DocCoverage ;
648631 use crate :: test:: {
@@ -653,6 +636,7 @@ mod test {
653636 use kuchikiki:: traits:: TendrilSink ;
654637 use pretty_assertions:: assert_eq;
655638 use serde_json:: json;
639+ use std:: str:: FromStr as _;
656640 use test_case:: test_case;
657641
658642 async fn release ( version : & str , env : & TestEnvironment ) -> ReleaseId {
@@ -1236,11 +1220,4 @@ mod test {
12361220 assert ! ( axum_redirect( path) . is_err( ) ) ;
12371221 assert ! ( axum_cached_redirect( path, cache:: CachePolicy :: NoCaching ) . is_err( ) ) ;
12381222 }
1239-
1240- #[ test_case( "/something/" , "/something/" ) ] // already valid path
1241- #[ test_case( "/something>" , "/something%3E" ) ] // something to encode
1242- #[ test_case( "/something%3E" , "/something%3E" ) ] // re-running doesn't change anything
1243- fn test_encode_url_path ( input : & str , expected : & str ) {
1244- assert_eq ! ( encode_url_path( input) , expected) ;
1245- }
12461223}
0 commit comments