Skip to content

Commit 84829cd

Browse files
committed
Use .expect() instead of .unwrap() when forming rust-lang URL.
1 parent df82298 commit 84829cd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/web/rustdoc.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ impl RustLangRedirector {
7878
impl iron::Handler for RustLangRedirector {
7979
fn handle(&self, _req: &mut Request) -> IronResult<Response> {
8080
let url = url::Url::parse("https://doc.rust-lang.org/stable/")
81-
.unwrap()
81+
.expect("failed to parse rust-lang.org base URL")
8282
.join(self.target)
83-
.unwrap();
84-
let url = Url::from_generic_url(url).unwrap();
83+
.expect("failed to append crate name to rust-lang.org base URL");
84+
let url = Url::from_generic_url(url)
85+
.expect("failed to convert url::Url to iron::Url");
8586
Ok(Response::with((status::Found, Redirect(url))))
8687
}
8788
}

0 commit comments

Comments
 (0)