@@ -8,6 +8,7 @@ use std::collections::VecDeque;
88use std:: error:: Error ;
99use std:: path:: { Path , PathBuf } ;
1010use std:: process:: { Command , ExitCode } ;
11+ use std:: string:: ToString ;
1112use 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
4041fn 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}`).
8182Make sure your `rust-toolchain.toml` file contains the following:
8283-------------
8384{stripped_toolchain}
84- -------------"#
85+ -------------"
8586 ) . into ( ) ) ;
8687 }
8788 }
0 commit comments