@@ -26,6 +26,7 @@ use std::fs::read_to_string;
26
26
use std:: ops:: Deref ;
27
27
use std:: path:: Path ;
28
28
use std:: process:: exit;
29
+ use std:: string:: ToString ;
29
30
30
31
use anstream:: println;
31
32
@@ -190,24 +191,24 @@ pub fn main() {
190
191
exit ( rustc_driver:: catch_with_exit_code ( move || {
191
192
let mut orig_args: Vec < String > = env:: args ( ) . collect ( ) ;
192
193
193
- let has_sysroot_arg = |args : & mut Vec < String > | {
194
- if arg_value ( & args, "--sysroot" , |_| true ) . is_some ( ) {
194
+ let has_sysroot_arg = |args : & mut [ String ] | -> bool {
195
+ if arg_value ( args, "--sysroot" , |_| true ) . is_some ( ) {
195
196
return true ;
196
197
}
197
198
// https://doc.rust-lang.org/rustc/command-line-arguments.html#path-load-command-line-flags-from-a-path
198
- // Beside checking for existence of `--sysroot` from the args on the command line, we need to
199
+ // Beside checking for existence of `--sysroot` on the command line, we need to
199
200
// check for the arg files that are prefixed with @ as well to be consistent with rustc
200
201
for arg in args. iter ( ) {
201
- if let Some ( arg_file_path) = arg. strip_prefix ( "@" ) {
202
+ if let Some ( arg_file_path) = arg. strip_prefix ( '@' ) {
202
203
if let Ok ( arg_file) = read_to_string ( arg_file_path) {
203
- let split_arg_file: Vec < String > = arg_file. lines ( ) . map ( |s| s . to_string ( ) ) . collect ( ) ;
204
+ let split_arg_file: Vec < String > = arg_file. lines ( ) . map ( ToString :: to_string) . collect ( ) ;
204
205
if arg_value ( & split_arg_file, "--sysroot" , |_| true ) . is_some ( ) {
205
206
return true ;
206
207
}
207
208
}
208
209
}
209
210
}
210
- return false ;
211
+ false
211
212
} ;
212
213
213
214
let sys_root_env = std:: env:: var ( "SYSROOT" ) . ok ( ) ;
0 commit comments