diff options
| author | Mark Mansi <markm@cs.wisc.edu> | 2019-08-29 13:03:22 -0500 |
|---|---|---|
| committer | Mark Mansi <markm@cs.wisc.edu> | 2019-08-29 13:03:22 -0500 |
| commit | 2e59c4afd16ea7b887f3d81b5aeea8669b843afe (patch) | |
| tree | e11bd0c66f2fe91c63755c627247cd59081888ae /src/tools/rustbook | |
| parent | 6876f9bcdc94c5e0c8cde03040b428f24f19a051 (diff) | |
| download | rust-2e59c4afd16ea7b887f3d81b5aeea8669b843afe.tar.gz rust-2e59c4afd16ea7b887f3d81b5aeea8669b843afe.zip | |
fix bugs + review comments
Diffstat (limited to 'src/tools/rustbook')
| -rw-r--r-- | src/tools/rustbook/src/main.rs | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/tools/rustbook/src/main.rs b/src/tools/rustbook/src/main.rs index 0915600bb38..e155f3f7607 100644 --- a/src/tools/rustbook/src/main.rs +++ b/src/tools/rustbook/src/main.rs @@ -56,21 +56,22 @@ fn main() { eprintln!("Error: {}", err); // HACK: ignore timeouts - #[allow(unused_mut)] - let mut actually_broken = false; - - #[cfg(feature = "linkcheck")] - { - if let Ok(broken_links) = err.downcast::<BrokenLinks>() { - for cause in broken_links.links().iter() { - eprintln!("\tCaused By: {}", cause); - - if cause.contains("timed out") { - actually_broken = true; - } - } + let actually_broken = { + #[cfg(feature = "linkcheck")] + { + err.downcast::<BrokenLinks>() + .unwrap_or(false) + .links() + .iter() + .inspect(|cause| eprintln!("\tCaused By: {}", cause)) + .any(|cause| !cause.contains("timed out")); } - } + + #[cfg(not(feature = "linkcheck"))] + { + false + } + }; if actually_broken { std::process::exit(101); |
