Skip to content

Commit

Permalink
Make Clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Mar 6, 2022
1 parent ff59f9f commit a312a9c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 26 deletions.
21 changes: 12 additions & 9 deletions cargo-test-fuzz/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -935,15 +935,18 @@ fn for_each_entry(
}
output = true;
}
if let Some(status) = status {
if !flags.contains(Flags::RAW) && buffer.is_empty() {
println!("{:?}", status);
}
failure |= !status.success();
} else {
println!("Timeout");
timeout = true;
}
status.map_or_else(
|| {
println!("Timeout");
timeout = true;
},
|status| {
if !flags.contains(Flags::RAW) && buffer.is_empty() {
println!("{:?}", status);
}
failure |= !status.success();
},
);

nonempty = true;
}
Expand Down
2 changes: 1 addition & 1 deletion internal/src/dirs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ fn path_from_args_type<T>() -> String {

#[must_use]
fn path_from_target(krate: &str, target: &str) -> String {
krate.replace("-", "_") + "::" + target
krate.replace('-', "_") + "::" + target
}
35 changes: 19 additions & 16 deletions macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,22 +1026,25 @@ fn args_from_autos(autos: &[Expr]) -> Expr {

fn log(tokens: &TokenStream2) {
if log_enabled() {
if let Some(rustfmt) = find_installed_component("rustfmt") {
let mut popen = Exec::cmd(rustfmt)
.stdin(Redirection::Pipe)
.popen()
.expect("`popen` failed");
let mut stdin = popen
.stdin
.take()
.expect("Could not take `rustfmt`'s standard input");
write!(stdin, "{}", tokens).expect("Could not write to `rustfmt`'s standard input");
drop(stdin);
let status = popen.wait().expect("`wait` failed");
assert!(status.success(), "`rustfmt` failed");
} else {
println!("{}", tokens);
}
find_installed_component("rustfmt").map_or_else(
|| {
println!("{}", tokens);
},
|rustfmt| {
let mut popen = Exec::cmd(rustfmt)
.stdin(Redirection::Pipe)
.popen()
.expect("`popen` failed");
let mut stdin = popen
.stdin
.take()
.expect("Could not take `rustfmt`'s standard input");
write!(stdin, "{}", tokens).expect("Could not write to `rustfmt`'s standard input");
drop(stdin);
let status = popen.wait().expect("`wait` failed");
assert!(status.success(), "`rustfmt` failed");
},
);
}
}

Expand Down

0 comments on commit a312a9c

Please sign in to comment.