diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2020-09-17 10:13:16 +0200 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2020-09-17 10:13:16 +0200 |
| commit | 012974da7ad3737b296af4a401dfed2e8dcc22df (patch) | |
| tree | d125772c1968f2e2aaadd26f6750e47bb07a108e /compiler/rustc_driver/src | |
| parent | 95386b656e91168bf53e2ab63c6b992cae591fe7 (diff) | |
| download | rust-012974da7ad3737b296af4a401dfed2e8dcc22df.tar.gz rust-012974da7ad3737b296af4a401dfed2e8dcc22df.zip | |
use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip)
Diffstat (limited to 'compiler/rustc_driver/src')
| -rw-r--r-- | compiler/rustc_driver/src/args.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_driver/src/args.rs b/compiler/rustc_driver/src/args.rs index 5686819c61b..4f2febf04b1 100644 --- a/compiler/rustc_driver/src/args.rs +++ b/compiler/rustc_driver/src/args.rs @@ -4,8 +4,7 @@ use std::fs; use std::io; pub fn arg_expand(arg: String) -> Result<Vec<String>, Error> { - if arg.starts_with('@') { - let path = &arg[1..]; + if let Some(path) = arg.strip_prefix('@') { let file = match fs::read_to_string(path) { Ok(file) => file, Err(ref err) if err.kind() == io::ErrorKind::InvalidData => { |
