mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
Fix clippy suggestions
This commit is contained in:
1 parent
f443195d92
commit
f5de5487cc
7 files changed
+23
-31
No files matched your search
+13
-17
@@ -182,25 +182,21 @@ fn test_shell_parse_command() {
|
||||
assert_eq!(&s, "shell -x 'aaa bbb'");
|
||||
|
||||
let cmd = shell.command();
|
||||
// Command::get_program and Command::args are not yet available in stable channel.
|
||||
// https://doc.rust-lang.org/std/process/struct.Command.html#method.get_program
|
||||
let s = format!("{:?}", cmd);
|
||||
assert_eq!(&s, r#""shell" "-x" "aaa bbb""#);
|
||||
assert_eq!(cmd.get_program().to_string_lossy(), "shell");
|
||||
assert_eq!(
|
||||
cmd.get_args()
|
||||
.map(|a| a.to_string_lossy())
|
||||
.collect::<Vec<_>>(),
|
||||
vec!["-x", "aaa bbb"]
|
||||
);
|
||||
|
||||
// Error cases
|
||||
assert!(matches!(
|
||||
Shell::parse("shell 'foo").unwrap_err(),
|
||||
OptionsError::ShellParseError(_)
|
||||
));
|
||||
|
||||
match Shell::parse("shell 'foo").unwrap_err() {
|
||||
OptionsError::ShellParseError(_) => { /* ok */ }
|
||||
e => assert!(false, "Unexpected error: {}", e),
|
||||
}
|
||||
assert_eq!(Shell::parse("").unwrap_err(), OptionsError::EmptyShell);
|
||||
|
||||
match Shell::parse("").unwrap_err() {
|
||||
OptionsError::EmptyShell => { /* ok */ }
|
||||
e => assert!(false, "Unexpected error: {}", e),
|
||||
}
|
||||
|
||||
match Shell::parse("''").unwrap_err() {
|
||||
OptionsError::EmptyShell => { /* ok */ }
|
||||
e => assert!(false, "Unexpected error: {}", e),
|
||||
}
|
||||
assert_eq!(Shell::parse("''").unwrap_err(), OptionsError::EmptyShell);
|
||||
}
|
||||
Reference in new issue
Block a user