Skip to content

Commit 60f466d

Browse files
committed
use strip_prefix where it makes sense
1 parent b334004 commit 60f466d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/bin/miri.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(rustc_private)]
2+
#![feature(str_strip)]
23

34
extern crate rustc_middle;
45
extern crate rustc_driver;
@@ -208,7 +209,7 @@ fn main() {
208209
if seed.is_some() {
209210
panic!("Cannot specify -Zmiri-seed multiple times!");
210211
}
211-
let seed_raw = hex::decode(arg.trim_start_matches("-Zmiri-seed="))
212+
let seed_raw = hex::decode(arg.strip_prefix("-Zmiri-seed=").unwrap())
212213
.unwrap_or_else(|err| match err {
213214
FromHexError::InvalidHexCharacter { .. } => panic!(
214215
"-Zmiri-seed should only contain valid hex digits [0-9a-fA-F]"
@@ -230,10 +231,10 @@ fn main() {
230231
}
231232
arg if arg.starts_with("-Zmiri-env-exclude=") => {
232233
excluded_env_vars
233-
.push(arg.trim_start_matches("-Zmiri-env-exclude=").to_owned());
234+
.push(arg.strip_prefix("-Zmiri-env-exclude=").unwrap().to_owned());
234235
}
235236
arg if arg.starts_with("-Zmiri-track-pointer-tag=") => {
236-
let id: u64 = match arg.trim_start_matches("-Zmiri-track-pointer-tag=").parse()
237+
let id: u64 = match arg.strip_prefix("-Zmiri-track-pointer-tag=").unwrap().parse()
237238
{
238239
Ok(id) => id,
239240
Err(err) => panic!(
@@ -248,7 +249,7 @@ fn main() {
248249
}
249250
}
250251
arg if arg.starts_with("-Zmiri-track-alloc-id=") => {
251-
let id: u64 = match arg.trim_start_matches("-Zmiri-track-alloc-id=").parse()
252+
let id: u64 = match arg.strip_prefix("-Zmiri-track-alloc-id=").unwrap().parse()
252253
{
253254
Ok(id) => id,
254255
Err(err) => panic!(

0 commit comments

Comments
 (0)