Skip to content

Commit ca44758

Browse files
committed
Fix a bunch of clippy lints in the build system
1 parent eaa91b8 commit ca44758

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

build_system/bench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ fn hyperfine_command(
144144
}
145145

146146
for &(name, cmd) in cmds {
147-
if name != "" {
147+
if !name.is_empty() {
148148
bench.arg("-n").arg(name);
149149
}
150150
bench.arg(cmd);

build_system/build_backend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(crate) fn build_backend(
1616
) -> PathBuf {
1717
let _group = LogGroup::guard("Build backend");
1818

19-
let mut cmd = CG_CLIF.build(&bootstrap_host_compiler, dirs);
19+
let mut cmd = CG_CLIF.build(bootstrap_host_compiler, dirs);
2020

2121
let mut rustflags = rustflags_from_env("RUSTFLAGS");
2222
rustflags.push("-Zallow-features=rustc_private,f16,f128".to_owned());

build_system/build_sysroot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub(crate) fn build_sysroot(
4949
let mut build_cargo_wrapper_cmd = Command::new(&bootstrap_host_compiler.rustc);
5050
let wrapper_path = dist_dir.join(&wrapper_name);
5151
build_cargo_wrapper_cmd
52-
.arg(dirs.source_dir.join("scripts").join(&format!("{wrapper}.rs")))
52+
.arg(dirs.source_dir.join("scripts").join(format!("{wrapper}.rs")))
5353
.arg("-o")
5454
.arg(&wrapper_path)
5555
.arg("-Cstrip=debuginfo");

build_system/rustc_info.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::process::{Command, Stdio};
44
pub(crate) fn get_host_triple(rustc: &Path) -> String {
55
let version_info = Command::new(rustc)
66
.stderr(Stdio::inherit())
7-
.args(&["--print", "host-tuple"])
7+
.args(["--print", "host-tuple"])
88
.output()
99
.unwrap()
1010
.stdout;
@@ -14,7 +14,7 @@ pub(crate) fn get_host_triple(rustc: &Path) -> String {
1414
pub(crate) fn get_toolchain_name() -> String {
1515
let active_toolchain = Command::new("rustup")
1616
.stderr(Stdio::inherit())
17-
.args(&["show", "active-toolchain"])
17+
.args(["show", "active-toolchain"])
1818
.output()
1919
.unwrap()
2020
.stdout;
@@ -27,7 +27,7 @@ pub(crate) fn get_cargo_path() -> PathBuf {
2727
}
2828
let cargo_path = Command::new("rustup")
2929
.stderr(Stdio::inherit())
30-
.args(&["which", "cargo"])
30+
.args(["which", "cargo"])
3131
.output()
3232
.unwrap()
3333
.stdout;
@@ -40,7 +40,7 @@ pub(crate) fn get_rustc_path() -> PathBuf {
4040
}
4141
let rustc_path = Command::new("rustup")
4242
.stderr(Stdio::inherit())
43-
.args(&["which", "rustc"])
43+
.args(["which", "rustc"])
4444
.output()
4545
.unwrap()
4646
.stdout;
@@ -53,7 +53,7 @@ pub(crate) fn get_rustdoc_path() -> PathBuf {
5353
}
5454
let rustc_path = Command::new("rustup")
5555
.stderr(Stdio::inherit())
56-
.args(&["which", "rustdoc"])
56+
.args(["which", "rustdoc"])
5757
.output()
5858
.unwrap()
5959
.stdout;
@@ -63,7 +63,7 @@ pub(crate) fn get_rustdoc_path() -> PathBuf {
6363
pub(crate) fn get_default_sysroot(rustc: &Path) -> PathBuf {
6464
let default_sysroot = Command::new(rustc)
6565
.stderr(Stdio::inherit())
66-
.args(&["--print", "sysroot"])
66+
.args(["--print", "sysroot"])
6767
.output()
6868
.unwrap()
6969
.stdout;
@@ -74,7 +74,7 @@ pub(crate) fn get_default_sysroot(rustc: &Path) -> PathBuf {
7474
pub(crate) fn get_file_name(rustc: &Path, crate_name: &str, crate_type: &str) -> String {
7575
let file_name = Command::new(rustc)
7676
.stderr(Stdio::inherit())
77-
.args(&[
77+
.args([
7878
"--crate-name",
7979
crate_name,
8080
"--crate-type",

build_system/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ impl<'a> TestRunner<'a> {
355355

356356
let _guard = if !config::get_bool(config)
357357
|| (is_jit_test && !self.jit_supported)
358-
|| self.skip_tests.contains(&config)
358+
|| self.skip_tests.contains(config)
359359
{
360360
eprintln!("[{tag}] {testname} (skipped)");
361361
continue;

build_system/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl CargoProject {
162162
pub(crate) fn try_hard_link(src: impl AsRef<Path>, dst: impl AsRef<Path>) {
163163
let src = src.as_ref();
164164
let dst = dst.as_ref();
165-
if let Err(_) = fs::hard_link(src, dst) {
165+
if fs::hard_link(src, dst).is_err() {
166166
fs::copy(src, dst).unwrap(); // Fallback to copying if hardlinking failed
167167
}
168168
}
@@ -179,7 +179,7 @@ pub(crate) fn spawn_and_wait(mut cmd: Command) {
179179
/// Create the specified directory if it doesn't exist yet and delete all contents.
180180
pub(crate) fn ensure_empty_dir(path: &Path) {
181181
fs::create_dir_all(path).unwrap();
182-
let read_dir = match fs::read_dir(&path) {
182+
let read_dir = match fs::read_dir(path) {
183183
Ok(read_dir) => read_dir,
184184
Err(err) if err.kind() == io::ErrorKind::NotFound => {
185185
return;

0 commit comments

Comments
 (0)