File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -66,24 +66,24 @@ impl ToJson for RustdocPage {
66
66
}
67
67
68
68
pub struct RustLangRedirector {
69
- target : & ' static str ,
69
+ url : Url ,
70
70
}
71
71
72
72
impl RustLangRedirector {
73
73
pub fn new ( target : & ' static str ) -> Self {
74
- Self { target }
75
- }
76
- }
77
-
78
- impl iron:: Handler for RustLangRedirector {
79
- fn handle ( & self , _req : & mut Request ) -> IronResult < Response > {
80
74
let url = url:: Url :: parse ( "https://doc.rust-lang.org/stable/" )
81
75
. expect ( "failed to parse rust-lang.org base URL" )
82
- . join ( self . target )
76
+ . join ( target)
83
77
. expect ( "failed to append crate name to rust-lang.org base URL" ) ;
84
78
let url = Url :: from_generic_url ( url)
85
79
. expect ( "failed to convert url::Url to iron::Url" ) ;
86
- Ok ( Response :: with ( ( status:: Found , Redirect ( url) ) ) )
80
+ Self { url }
81
+ }
82
+ }
83
+
84
+ impl iron:: Handler for RustLangRedirector {
85
+ fn handle ( & self , _req : & mut Request ) -> IronResult < Response > {
86
+ Ok ( Response :: with ( ( status:: Found , Redirect ( self . url . clone ( ) ) ) ) )
87
87
}
88
88
}
89
89
You can’t perform that action at this time.
0 commit comments