Fix clippy warnings
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Peter · committed by David Peter · parent b6ff23a · Browse files · 3 files·+8 added−8 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+8 added−8 removed
- other:+8 added−8 removed
Provenance
- Commit
f029a46- Tree
d6fe7fd- Author
David Peter <mail@david-peter.de>- Committer
David Peter <mail@david-peter.de>- Parent
b6ff23a
3 files changed+8 added−8 removed
modified:src/benchmark/executor.rs+1 added-1 removed
60 unmodified lines61 CommandOutputPolicy::Forward => (Stdio::inherit(), Stdio::inherit()),62 };63 64 let wallclock_timer = WallClockTimer::start();65- let result = execute_and_time(stdout, stderr, &command.get_shell_command(), &self.shell)?;65+ let result = execute_and_time(stdout, stderr, &command.get_shell_command(), self.shell)?;66 let mut time_real = wallclock_timer.stop();67 68 let mut time_user = result.user_time;69 let mut time_system = result.system_time;160 unmodified linesmodified:src/benchmark/scheduler.rs+1 added-1 removed
32 unmodified lines33 34 pub fn run_benchmarks(&mut self) -> Result<()> {35 let mut executor: Box<dyn Executor> = match self.options.executor_kind {36 ExecutorKind::Mock(ref shell) => Box::new(MockExecutor::new(shell.clone())),37- ExecutorKind::Shell(ref shell) => Box::new(ShellExecutor::new(shell, &self.options)),37+ ExecutorKind::Shell(ref shell) => Box::new(ShellExecutor::new(shell, self.options)),38 };39 40 executor.calibrate()?;41 55 unmodified linesmodified:src/options.rs+6 added-6 removed
42 unmodified lines43 }44 45 impl Shell {46 /// Parse given string as shell command line47- pub fn from_str<'a>(s: &str) -> Result<Self, OptionsError<'a>> {47+ pub fn parse_from_str<'a>(s: &str) -> Result<Self, OptionsError<'a>> {48 let v = shell_words::split(s).map_err(OptionsError::ShellParseError)?;49 if v.is_empty() || v[0].is_empty() {50 return Err(OptionsError::EmptyShell);51 }221 unmodified lines273 };274 275 options.executor_kind = match (matches.is_present("debug-mode"), matches.value_of("shell"))276 {277- (false, Some(shell)) => ExecutorKind::Shell(Shell::from_str(shell)?),277+ (false, Some(shell)) => ExecutorKind::Shell(Shell::parse_from_str(shell)?),278 (false, None) => ExecutorKind::Shell(Shell::default()),279 (true, Some(shell)) => ExecutorKind::Mock(Some(shell.into())),280 (true, None) => ExecutorKind::Mock(None),281 };37 unmodified lines319 }320 321 #[test]322 fn test_can_parse_shell_command_line_from_str() {323- let shell = Shell::from_str("shell -x 'aaa bbb'").unwrap();323+ let shell = Shell::parse_from_str("shell -x 'aaa bbb'").unwrap();324 325 let s = format!("{}", shell);326 assert_eq!(&s, "shell -x 'aaa bbb'");327 7 unmodified lines335 );336 337 // Error cases338 assert!(matches!(339- Shell::from_str("shell 'foo").unwrap_err(),339+ Shell::parse_from_str("shell 'foo").unwrap_err(),340 OptionsError::ShellParseError(_)341 ));342 343 assert!(matches!(344- Shell::from_str("").unwrap_err(),344+ Shell::parse_from_str("").unwrap_err(),345 OptionsError::EmptyShell346 ));347 348 assert!(matches!(349- Shell::from_str("''").unwrap_err(),349+ Shell::parse_from_str("''").unwrap_err(),350 OptionsError::EmptyShell351 ));352 }