Skip to content
Myr

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

3 files+8 added−8 removed

modified:src/benchmark/executor.rs+1 added-1 removed
60 unmodified lines
61 CommandOutputPolicy::Forward => (Stdio::inherit(), Stdio::inherit()),62 };6364 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();6768 let mut time_user = result.user_time;69 let mut time_system = result.system_time;
160 unmodified lines
modified:src/benchmark/scheduler.rs+1 added-1 removed
32 unmodified lines
3334 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 };3940 executor.calibrate()?;41
55 unmodified lines
modified:src/options.rs+6 added-6 removed
42 unmodified lines
43}4445impl 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 lines
273 };274275 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 lines
319}320321#[test]322fn 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();324325 let s = format!("{}", shell);326 assert_eq!(&s, "shell -x 'aaa bbb'");327
7 unmodified lines
335 );336337 // 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 ));342343 assert!(matches!(344 Shell::from_str("").unwrap_err(),344 Shell::parse_from_str("").unwrap_err(),345 OptionsError::EmptyShell346 ));347348 assert!(matches!(349 Shell::from_str("''").unwrap_err(),349 Shell::parse_from_str("''").unwrap_err(),350 OptionsError::EmptyShell351 ));352}