Skip to content

Commit

Permalink
more clippy cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Dec 26, 2023
1 parent cdc04b5 commit 7db2e7f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/ice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl ICE {
.clone()
.into_iter()
.filter(|flag| {
!["-ooutputfile".to_string(), "-Zdump-mir-dir=dir".to_string()].contains(&flag)
!["-ooutputfile".to_string(), "-Zdump-mir-dir=dir".to_string()].contains(flag)
})
.collect::<Vec<_>>();
let flags = flags.join(" ");
Expand Down
14 changes: 8 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ fn check_dir(
if args.skip_report {
eprintln!("Skipping reports as asked via --skip-report");
} else {
if new_ices.len() == 0 {
if new_ices.is_empty() {
eprintln!("No new, ices, skipping reports...");
} else {
eprintln!("Generating reports...");
Expand Down Expand Up @@ -1089,6 +1089,7 @@ impl ICE {
find_ICE_string(file, executable, cmd_output);

// if rustdoc crashes on a file that does not compile, turn this into a ICEKind::RustdocFrailness
#[allow(clippy::single_match)]
match (&found_error, executable) {
(Some((errstring, ICEKind::Ice(_))), Executable::Rustdoc) => {
if !file_compiles(
Expand Down Expand Up @@ -2424,12 +2425,13 @@ fn codegen_git_original_dirs() {

let final_path = format!("{}/{}", dir.display(), file_path.to_str().unwrap());

std::fs::write(&final_path, text)
.expect(&format!("failed to write to file: '{final_path}'"));
std::fs::write(&final_path, text).unwrap_or_else(|_| {
panic!("failed to write to file: '{final_path}'");
});
} else {
eprintln!(
"not writing file {}",
format!("{}/{}", dir.display(), file_path.to_str().unwrap())
format_args!("{}/{}", dir.display(), file_path.to_str().unwrap())
);
}
})
Expand Down Expand Up @@ -2814,7 +2816,7 @@ pub(crate) fn reduce_ice_code(ice: ICE, global_tempdir_path: &Path) {

let mut trd = std::process::Command::new("prlimit");
trd.arg(format!("--as={}", 3076_u32 * 1000_u32 * 1000_u32)) // 3 gb of ram
.arg(format!("--cpu=120")) // 2 mins
.arg("--cpu=120") // 2 mins
.arg("treereduce-rust");
trd.args([
"--quiet",
Expand Down Expand Up @@ -2928,7 +2930,7 @@ pub(crate) fn reduce_ice_code_to_string(ice: ICE, global_tempdir_path: &Path) ->

let mut trd = std::process::Command::new("prlimit");
trd.arg(format!("--as={}", 3076_u32 * 1000_u32 * 1000_u32)) // 3 gb of ram
.arg(format!("--cpu=120")) // 2 mins
.arg("--cpu=120") // 2 mins
.arg("treereduce-rust");
trd.args([
"--quiet",
Expand Down
9 changes: 4 additions & 5 deletions src/run_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,8 @@ pub(crate) fn run_rustc(
.map(|x| x.as_str())
.map(|s| s.strip_prefix("[feature(").unwrap_or(s))
.map(|s| s.strip_suffix(")]").unwrap_or(s))
.map(|s| s.split(","))
.flatten()
.filter(|s| s.len() > 0)
.flat_map(|s| s.split(','))
.filter(|s| !s.is_empty())
// remove surrounding whitespaces etc
.map(|s| s.trim())
.map(|s| s.trim_matches(|c| ['(', ')', '[', ']'].contains(&c)))
Expand All @@ -138,7 +137,7 @@ pub(crate) fn run_rustc(
.iter()
.any(|fif| flag.contains(fif))
})
.map(|x| *x);
.copied();

let dump_mir_dir = format!("-Zdump-mir-dir={tempdir_path}");

Expand Down Expand Up @@ -1446,7 +1445,7 @@ pub(crate) fn run_marker(
.arg("--edition=2024")
.args(["--cap-lints", "warn"])
.args(["-o", "/dev/null"])
.current_dir(&global_tempdir_path);
.current_dir(global_tempdir_path);

let output = prlimit_run_command(&mut cmd).unwrap();

Expand Down

0 comments on commit 7db2e7f

Please sign in to comment.