Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 538989e

Browse files
committed
Apply Clippy lints
1 parent 1871840 commit 538989e

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/build/external.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,10 @@ fn plan_from_analysis(analysis: &[Analysis], build_dir: &Path) -> Result<Externa
146146
.cloned()
147147
.collect();
148148

149-
let cwd = match directory.is_relative() {
150-
true => build_dir.join(directory),
151-
false => directory.to_owned(),
149+
let cwd = if directory.is_relative() {
150+
build_dir.join(directory)
151+
} else {
152+
directory.to_owned()
152153
};
153154

154155
Ok(RawInvocation {
@@ -442,7 +443,7 @@ fn guess_rustc_src_path(build_dir: &Path, cmd: &ProcessBuilder) -> Option<PathBu
442443
return None;
443444
}
444445

445-
let cwd = cmd.get_cwd().or(Some(build_dir));
446+
let cwd = cmd.get_cwd().or_else(|| Some(build_dir));
446447

447448
let file = cmd
448449
.get_args()
@@ -491,7 +492,7 @@ mod tests {
491492
}
492493
}
493494

494-
fn paths(invocations: &Vec<&Invocation>) -> Vec<PathBuf> {
495+
fn paths(invocations: &[&Invocation]) -> Vec<PathBuf> {
495496
invocations
496497
.iter()
497498
.filter_map(|d| d.src_path.clone())

src/build/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ impl Internals {
563563
WorkStatus::Execute(_) if needs_rebuild => {
564564
WorkStatus::NeedsCargo(PackageArg::Default)
565565
},
566-
work @ _ => work,
566+
work => work,
567567
}
568568
}
569569
}

src/build/rustc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ crate fn rustc(
8787
config.clippy_preference
8888
};
8989
// Required for Clippy not to crash when running outside Cargo?
90-
local_envs.entry("CARGO_MANIFEST_DIR".into()).or_insert(Some(build_dir.clone().into()));
90+
local_envs.entry("CARGO_MANIFEST_DIR".into())
91+
.or_insert_with(|| Some(build_dir.into()));
9192

9293
let (guard, _) = env_lock.lock();
9394
let restore_env = Environment::push_with_lock(&local_envs, cwd, guard);

0 commit comments

Comments
 (0)