Skip to content

Commit 808974a

Browse files
fooLegNeato
authored andcommitted
Remove unnecessary closures
1 parent 67ccf2f commit 808974a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

crates/rustc_codegen_spirv/build.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use std::collections::VecDeque;
88
use std::error::Error;
99
use std::path::{Path, PathBuf};
1010
use std::process::{Command, ExitCode};
11+
use std::string::ToString;
1112
use std::{env, fs, mem};
1213

1314
/// Current `rust-toolchain.toml` file
@@ -33,15 +34,15 @@ fn get_rustc_commit_hash() -> Result<String, Box<dyn Error>> {
3334
rustc_output("-vV")?
3435
.lines()
3536
.find_map(|l| l.strip_prefix("commit-hash: "))
36-
.map(|s| s.to_string())
37+
.map(ToString::to_string)
3738
.ok_or_else(|| "`commit-hash` not found in `rustc -vV` output".into())
3839
}
3940

4041
fn get_required_commit_hash() -> Result<String, Box<dyn Error>> {
4142
REQUIRED_RUST_TOOLCHAIN
4243
.lines()
4344
.find_map(|l| l.strip_prefix("# commit_hash = "))
44-
.map(|s| s.to_string())
45+
.map(ToString::to_string)
4546
.ok_or_else(|| "`commit_hash` not found in `rust-toolchain.toml`".into())
4647
}
4748

@@ -72,16 +73,16 @@ fn check_toolchain_version() -> Result<(), Box<dyn Error>> {
7273
let stripped_toolchain = REQUIRED_RUST_TOOLCHAIN
7374
.lines()
7475
.filter(|l| !l.trim().is_empty() && !l.starts_with("# "))
75-
.map(|l| l.to_string())
76+
.map(ToString::to_string)
7677
.reduce(|a, b| a + "\n" + &b)
7778
.unwrap_or_default();
7879

7980
return Err(format!(
80-
r#"error: wrong toolchain detected (found commit hash `{current_hash}`, expected `{required_hash}`).
81+
"error: wrong toolchain detected (found commit hash `{current_hash}`, expected `{required_hash}`).
8182
Make sure your `rust-toolchain.toml` file contains the following:
8283
-------------
8384
{stripped_toolchain}
84-
-------------"#
85+
-------------"
8586
).into());
8687
}
8788
}

0 commit comments

Comments
 (0)