Skip to content

Commit af8c009

Browse files
reformat block that prints 404 logs
1 parent bd4b008 commit af8c009

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

src/web/mod.rs

+20-22
Original file line numberDiff line numberDiff line change
@@ -237,33 +237,31 @@ impl Handler for CratesfyiHandler {
237237
panic!("all cratesfyi errors should be of type Nope");
238238
};
239239

240-
match err {
241-
error::Nope::ResourceNotFound => {
242-
// print the path of the URL that triggered a 404 error
243-
struct DebugPath<'a>(&'a iron::Url);
244-
impl<'a> fmt::Display for DebugPath<'a> {
245-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
246-
for path_elem in self.0.path() {
247-
write!(f, "/{}", path_elem)?;
248-
}
249-
250-
if let Some(query) = self.0.query() {
251-
write!(f, "?{}", query)?;
252-
}
253-
254-
if let Some(hash) = self.0.fragment() {
255-
write!(f, "#{}", hash)?;
256-
}
257-
258-
Ok(())
240+
if let error::Nope::ResourceNotFound = err {
241+
// print the path of the URL that triggered a 404 error
242+
struct DebugPath<'a>(&'a iron::Url);
243+
impl<'a> fmt::Display for DebugPath<'a> {
244+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
245+
for path_elem in self.0.path() {
246+
write!(f, "/{}", path_elem)?;
247+
}
248+
249+
if let Some(query) = self.0.query() {
250+
write!(f, "?{}", query)?;
251+
}
252+
253+
if let Some(hash) = self.0.fragment() {
254+
write!(f, "#{}", hash)?;
259255
}
260-
}
261256

262-
debug!("Path not found: {}", DebugPath(&req.url));
257+
Ok(())
258+
}
263259
}
264-
_ => {}
260+
261+
debug!("Path not found: {}", DebugPath(&req.url));
265262
}
266263

264+
267265
Self::chain(err).handle(req)
268266
})
269267
}

0 commit comments

Comments
 (0)