aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Tjäder <henrik@tjaders.com>2025-06-08 13:46:46 +0200
committerEmil Fresk <emil.fresk@gmail.com>2025-06-15 08:11:11 +0000
commit38cba9f3ad25624bffe3c57820cff354e9760602 (patch)
tree22b973607b908b74a148da26e42669468a69e8e4
parent9bc60cc5ed4c66fa24fa1a9c24e7e4c27b94d546 (diff)
xtask: Cargo clippy lints
-rw-r--r--xtask/src/cargo_command.rs35
-rw-r--r--xtask/src/main.rs6
-rw-r--r--xtask/src/run/iter.rs2
3 files changed, 19 insertions, 24 deletions
diff --git a/xtask/src/cargo_command.rs b/xtask/src/cargo_command.rs
index e711f74..1fe37d2 100644
--- a/xtask/src/cargo_command.rs
+++ b/xtask/src/cargo_command.rs
@@ -117,7 +117,7 @@ impl core::fmt::Display for CargoCommand<'_> {
if let Some(package) = p {
format!("package {package}")
} else {
- format!("default package")
+ "default package".to_string()
}
}
@@ -125,15 +125,15 @@ impl core::fmt::Display for CargoCommand<'_> {
if let Some(features) = f {
format!("\"{features}\"")
} else {
- format!("no features")
+ "no features".to_string()
}
}
fn carg(f: &&Option<&str>) -> String {
if let Some(cargoarg) = f {
- format!("{cargoarg}")
+ cargoarg.to_string()
} else {
- format!("no cargo args")
+ "no cargo args".to_string()
}
}
@@ -152,25 +152,25 @@ impl core::fmt::Display for CargoCommand<'_> {
let path = path.to_str().unwrap_or("<can't display>");
format!("in {path}")
} else {
- format!("")
+ "".to_string()
};
let target = if let Some(target) = target {
format!("{target}")
} else {
- format!("<no explicit target>")
+ "<no explicit target>".to_string()
};
let mode = if let Some(mode) = mode {
format!("{mode}")
} else {
- format!("debug")
+ "debug".to_string()
};
let deny_warnings = if deny_warnings {
- format!("deny warnings, ")
+ "deny warnings, ".to_string()
} else {
- format!("")
+ "".to_string()
};
if cargoarg.is_some() && path.is_some() {
@@ -299,7 +299,7 @@ impl core::fmt::Display for CargoCommand<'_> {
let carg = if cargoarg.is_some() {
format!("(cargo args: {carg})")
} else {
- format!("")
+ String::new()
};
if *check_only {
@@ -321,9 +321,9 @@ impl core::fmt::Display for CargoCommand<'_> {
.map(|a| format!("{a}"))
.unwrap_or_else(|| "no extra arguments".into());
let deny_warnings = if *deny_warnings {
- format!("deny warnings, ")
+ "deny warnings, ".to_string()
} else {
- format!("")
+ String::new()
};
if cargoarg.is_some() {
write!(f, "Document ({deny_warnings}{feat}, {carg}, {arguments})")
@@ -371,13 +371,13 @@ impl<'a> CargoCommand<'a> {
let env = if let Some((key, value)) = self.extra_env() {
format!("{key}=\"{value}\" ")
} else {
- format!("")
+ String::new()
};
let cd = if let Some(Some(chdir)) = self.chdir().map(|p| p.to_str()) {
format!("cd {chdir} && ")
} else {
- format!("")
+ String::new()
};
let executable = self.executable();
@@ -445,7 +445,7 @@ impl<'a> CargoCommand<'a> {
args.extend_from_slice(&["--features", features]);
}
- if let Some(mode) = mode.map(|m| m.to_flag()).flatten() {
+ if let Some(mode) = mode.and_then(|m| m.to_flag()) {
args.push(mode);
}
@@ -753,10 +753,7 @@ impl<'a> CargoCommand<'a> {
}
pub fn print_stdout_intermediate(&self) -> bool {
- match self {
- Self::ExampleSize { .. } => true,
- _ => false,
- }
+ matches!(self, Self::ExampleSize { .. })
}
}
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index 7182b49..1d9a2ac 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -89,11 +89,7 @@ fn main() -> anyhow::Result<()> {
);
log::debug!("Partial features: {}", globals.partial);
- let platform = if let Some(platform) = globals.platform {
- platform
- } else {
- Platforms::default()
- };
+ let platform = globals.platform.unwrap_or_default();
let backend = if let Some(backend) = globals.backend {
backend
diff --git a/xtask/src/run/iter.rs b/xtask/src/run/iter.rs
index d18ad49..d53a9d2 100644
--- a/xtask/src/run/iter.rs
+++ b/xtask/src/run/iter.rs
@@ -9,6 +9,7 @@ pub trait CoalescingRunner<'c> {
}
#[cfg(not(feature = "rayon"))]
+#[allow(clippy::module_inception)]
mod iter {
use super::*;
use crate::{argument_parsing::Globals, cargo_command::*, run::run_and_convert};
@@ -28,6 +29,7 @@ mod iter {
}
#[cfg(feature = "rayon")]
+#[allow(clippy::module_inception)]
mod iter {
use super::*;
use crate::{argument_parsing::Globals, cargo_command::*, run::run_and_convert};