Skip to content

Commit 2e59c4a

Browse files
committed
fix bugs + review comments
1 parent 6876f9b commit 2e59c4a

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/tools/rustbook/src/main.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,22 @@ fn main() {
5656
eprintln!("Error: {}", err);
5757

5858
// HACK: ignore timeouts
59-
#[allow(unused_mut)]
60-
let mut actually_broken = false;
61-
62-
#[cfg(feature = "linkcheck")]
63-
{
64-
if let Ok(broken_links) = err.downcast::<BrokenLinks>() {
65-
for cause in broken_links.links().iter() {
66-
eprintln!("\tCaused By: {}", cause);
67-
68-
if cause.contains("timed out") {
69-
actually_broken = true;
70-
}
71-
}
59+
let actually_broken = {
60+
#[cfg(feature = "linkcheck")]
61+
{
62+
err.downcast::<BrokenLinks>()
63+
.unwrap_or(false)
64+
.links()
65+
.iter()
66+
.inspect(|cause| eprintln!("\tCaused By: {}", cause))
67+
.any(|cause| !cause.contains("timed out"));
7268
}
73-
}
69+
70+
#[cfg(not(feature = "linkcheck"))]
71+
{
72+
false
73+
}
74+
};
7475

7576
if actually_broken {
7677
std::process::exit(101);

0 commit comments

Comments
 (0)