diff --git a/crates/rustc_codegen_spirv/build.rs b/crates/rustc_codegen_spirv/build.rs index 3cf04312e1..4577f73793 100644 --- a/crates/rustc_codegen_spirv/build.rs +++ b/crates/rustc_codegen_spirv/build.rs @@ -8,6 +8,7 @@ use std::collections::VecDeque; use std::error::Error; use std::path::{Path, PathBuf}; use std::process::{Command, ExitCode}; +use std::string::ToString; use std::{env, fs, mem}; /// Current `rust-toolchain.toml` file @@ -33,7 +34,7 @@ fn get_rustc_commit_hash() -> Result> { rustc_output("-vV")? .lines() .find_map(|l| l.strip_prefix("commit-hash: ")) - .map(|s| s.to_string()) + .map(ToString::to_string) .ok_or_else(|| "`commit-hash` not found in `rustc -vV` output".into()) } @@ -41,7 +42,7 @@ fn get_required_commit_hash() -> Result> { REQUIRED_RUST_TOOLCHAIN .lines() .find_map(|l| l.strip_prefix("# commit_hash = ")) - .map(|s| s.to_string()) + .map(ToString::to_string) .ok_or_else(|| "`commit_hash` not found in `rust-toolchain.toml`".into()) } @@ -72,16 +73,16 @@ fn check_toolchain_version() -> Result<(), Box> { let stripped_toolchain = REQUIRED_RUST_TOOLCHAIN .lines() .filter(|l| !l.trim().is_empty() && !l.starts_with("# ")) - .map(|l| l.to_string()) + .map(ToString::to_string) .reduce(|a, b| a + "\n" + &b) .unwrap_or_default(); return Err(format!( - r#"error: wrong toolchain detected (found commit hash `{current_hash}`, expected `{required_hash}`). + "error: wrong toolchain detected (found commit hash `{current_hash}`, expected `{required_hash}`). Make sure your `rust-toolchain.toml` file contains the following: ------------- {stripped_toolchain} --------------"# +-------------" ).into()); } }