Skip to content

Fix all new clippy lints since Rust 1.88 #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions compile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,14 +473,14 @@ impl Config {
// The ispc compiler crashes if we give -O0 and --cpu=generic,
// see https://github.com/ispc/ispc/issues/1223
if *c != CPU::Generic || (*c == CPU::Generic && opt_level != 0) {
ispc_args.push(String::from("-O") + &opt_level.to_string());
ispc_args.push(format!("-O{opt_level}"));
} else {
self.print(
&"cargo:warning=ispc-rs: Omitting -O0 on CPU::Generic target, ispc bug 1223",
);
}
} else {
ispc_args.push(String::from("-O") + &opt_level.to_string());
ispc_args.push(format!("-O{opt_level}"));
}

// If we're on Unix we need position independent code
Expand All @@ -495,18 +495,18 @@ impl Config {
} else if target.starts_with("aarch64") {
ispc_args.push(String::from("--arch=aarch64"));
}
for d in &self.defines {
match d.1 {
Some(ref v) => ispc_args.push(format!("-D{}={}", d.0, v)),
None => ispc_args.push(format!("-D{}", d.0)),
for (name, value) in &self.defines {
match value {
Some(value) => ispc_args.push(format!("-D{name}={value}")),
None => ispc_args.push(format!("-D{name}")),
}
}
ispc_args.push(self.math_lib.to_string());
if let Some(ref s) = self.addressing {
ispc_args.push(s.to_string());
}
if let Some(ref f) = self.force_alignment {
ispc_args.push(String::from("--force-alignment=") + &f.to_string());
ispc_args.push(format!("--force-alignment={f}"));
}
for o in &self.optimization_opts {
ispc_args.push(o.to_string());
Expand Down Expand Up @@ -543,9 +543,12 @@ impl Config {
}
if let Some(ref t) = self.target_isa {
let mut isa_str = String::from("--target=");
isa_str.push_str(&t[0].to_string());
for isa in t.iter().skip(1) {
isa_str.push_str(&format!(",{}", isa));
for (i, isa) in t.iter().enumerate() {
if i > 0 {
isa_str.push(',');
}
use std::fmt::Write as _;
let _ = write!(isa_str, "{isa}");
}
ispc_args.push(isa_str);
} else if target.starts_with("aarch64") {
Expand Down Expand Up @@ -584,7 +587,7 @@ impl Config {
/// env("DEBUG")
fn get_debug(&self) -> bool {
self.debug
.unwrap_or_else(|| env::var("DEBUG").map(|x| x == "true").unwrap())
.unwrap_or_else(|| env::var("DEBUG").unwrap() == "true")
}
/// Returns the user-set optimization level if they've set one, otherwise
/// returns env("OPT_LEVEL")
Expand Down
2 changes: 1 addition & 1 deletion compile/src/opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl std::fmt::Display for OptimizationOpt {
OptimizationOpt::ForceAlignedMemory => "force-aligned-memory",
OptimizationOpt::ResetFTZDaz => "reset-ftz-daz",
};
write!(f, "--opt={}", option_str)
write!(f, "--opt={option_str}")
}
}

Expand Down