Skip to content

Commit 166e671

Browse files
author
Vinh Tran
committed
Fix dogfood lint error
1 parent af9140d commit 166e671

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/driver.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use std::fs::read_to_string;
2626
use std::ops::Deref;
2727
use std::path::Path;
2828
use std::process::exit;
29+
use std::string::ToString;
2930

3031
use anstream::println;
3132

@@ -190,24 +191,24 @@ pub fn main() {
190191
exit(rustc_driver::catch_with_exit_code(move || {
191192
let mut orig_args: Vec<String> = env::args().collect();
192193

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() {
195196
return true;
196197
}
197198
// 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
199200
// check for the arg files that are prefixed with @ as well to be consistent with rustc
200201
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('@') {
202203
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();
204205
if arg_value(&split_arg_file, "--sysroot", |_| true).is_some() {
205206
return true;
206207
}
207208
}
208209
}
209210
}
210-
return false;
211+
false
211212
};
212213

213214
let sys_root_env = std::env::var("SYSROOT").ok();

0 commit comments

Comments
 (0)