applease clippy

This commit is contained in:
Pietro Albini 2025-01-08 21:34:57 +01:00
parent 2af3ba9a8a
commit a7f84e981e
No known key found for this signature in database
GPG key ID: 3E06ABE80BAAF19C
6 changed files with 8 additions and 8 deletions

View file

@ -344,7 +344,7 @@ impl Step for RustAnalyzer {
.config
.tools
.as_ref()
.map_or(true, |tools| tools.iter().any(|tool| tool == "rust-analyzer")),
.is_none_or(|tools| tools.iter().any(|tool| tool == "rust-analyzer")),
)
}

View file

@ -1673,10 +1673,10 @@ impl Step for Sysroot {
];
let ci_rustc_dir = builder.config.ci_rustc_dir();
builder.cp_link_filtered(&ci_rustc_dir, &sysroot, &|path| {
if path.extension().map_or(true, |ext| !filtered_extensions.contains(&ext)) {
if path.extension().is_none_or(|ext| !filtered_extensions.contains(&ext)) {
return true;
}
if !path.parent().map_or(true, |p| p.ends_with(&suffix)) {
if !path.parent().is_none_or(|p| p.ends_with(&suffix)) {
return true;
}
if !filtered_files.iter().all(|f| f != path.file_name().unwrap()) {

View file

@ -47,7 +47,7 @@ fn should_build_extended_tool(builder: &Builder<'_>, tool: &str) -> bool {
if !builder.config.extended {
return false;
}
builder.config.tools.as_ref().map_or(true, |tools| tools.contains(tool))
builder.config.tools.as_ref().is_none_or(|tools| tools.contains(tool))
}
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
@ -410,7 +410,7 @@ impl Step for Rustc {
.config
.tools
.as_ref()
.map_or(true, |tools| tools.iter().any(|tool| tool == "rustdoc"))
.is_none_or(|tools| tools.iter().any(|tool| tool == "rustdoc"))
{
let rustdoc = builder.rustdoc(compiler);
builder.install(&rustdoc, &image.join("bin"), 0o755);

View file

@ -307,7 +307,7 @@ impl Step for Src {
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let config = &run.builder.config;
let cond = config.extended && config.tools.as_ref().map_or(true, |t| t.contains("src"));
let cond = config.extended && config.tools.as_ref().is_none_or(|t|t.contains("src"));
run.path("src").default_condition(cond)
}

View file

@ -1443,7 +1443,7 @@ impl<'a> Builder<'a> {
let mut stack = self.stack.borrow_mut();
for stack_step in stack.iter() {
// should skip
if stack_step.downcast_ref::<S>().map_or(true, |stack_step| *stack_step != step) {
if stack_step.downcast_ref::<S>().is_none_or(|stack_step| *stack_step != step) {
continue;
}
let mut out = String::new();

View file

@ -1125,7 +1125,7 @@ impl<'de> Deserialize<'de> for LldMode {
match v {
"external" => Ok(LldMode::External),
"self-contained" => Ok(LldMode::SelfContained),
_ => Err(E::custom("unknown mode {v}")),
_ => Err(E::custom(format!("unknown mode {v}"))),
}
}
}