From 2ced7ecb9f54e2798989ff5e5946c73f4b740afe Mon Sep 17 00:00:00 2001 From: hyd-dev Date: Sat, 26 Jun 2021 21:49:56 +0800 Subject: [PATCH] `ArgFlagValueWithOtherArgsIter` -> `ArgSplitFlagValue` --- cargo-miri/bin.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cargo-miri/bin.rs b/cargo-miri/bin.rs index c87325614bbe..939ea5ac507f 100644 --- a/cargo-miri/bin.rs +++ b/cargo-miri/bin.rs @@ -114,12 +114,12 @@ fn has_arg_flag(name: &str) -> bool { /// Yields all values of command line flag `name` as `Ok(arg)`, and all other arguments except /// the flag as `Err(arg)`. -struct ArgFlagValueWithOtherArgsIter<'a, I> { +struct ArgSplitFlagValue<'a, I> { args: TakeWhile bool>, name: &'a str, } -impl<'a, I: Iterator> ArgFlagValueWithOtherArgsIter<'a, I> { +impl<'a, I: Iterator> ArgSplitFlagValue<'a, I> { fn new(args: I, name: &'a str) -> Self { Self { // Stop searching at `--`. @@ -129,7 +129,7 @@ impl<'a, I: Iterator> ArgFlagValueWithOtherArgsIter<'a, I> { } } -impl> Iterator for ArgFlagValueWithOtherArgsIter<'_, I> { +impl> Iterator for ArgSplitFlagValue<'_, I> { type Item = Result; fn next(&mut self) -> Option { @@ -151,11 +151,11 @@ impl> Iterator for ArgFlagValueWithOtherArgsIter<'_, } /// Yields all values of command line flag `name`. -struct ArgFlagValueIter<'a>(ArgFlagValueWithOtherArgsIter<'a, env::Args>); +struct ArgFlagValueIter<'a>(ArgSplitFlagValue<'a, env::Args>); impl<'a> ArgFlagValueIter<'a> { fn new(name: &'a str) -> Self { - Self(ArgFlagValueWithOtherArgsIter::new(env::args(), name)) + Self(ArgSplitFlagValue::new(env::args(), name)) } } @@ -484,7 +484,7 @@ fn detect_target_dir() -> PathBuf { // The `build.target-dir` config can by passed by `--config` flags, so forward them to // `cargo metadata`. let config_flag = "--config"; - for arg in ArgFlagValueWithOtherArgsIter::new( + for arg in ArgSplitFlagValue::new( env::args().skip(3), // skip the program name, "miri" and "run" / "test" config_flag, ) { @@ -570,7 +570,7 @@ fn phase_cargo_miri(mut args: env::Args) { let mut target_dir = None; // Forward all arguments before `--` other than `--target-dir` and its value to Cargo. - for arg in ArgFlagValueWithOtherArgsIter::new(&mut args, "--target-dir") { + for arg in ArgSplitFlagValue::new(&mut args, "--target-dir") { match arg { Ok(value) => target_dir = Some(value.into()), Err(arg) => drop(cmd.arg(arg)),