Fix clippy suggestions
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 f443195 · Browse files · 7 files·+23 added−31 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+23 added−31 removed
- other:+23 added−31 removed
Provenance
- Commit
f5de548- Tree
1ad808e- Author
David Peter <mail@david-peter.de>- Committer
David Peter <sharkdp@users.noreply.github.com>- Parent
f443195
7 files changed+23 added−31 removed
modified:.github/workflows/CICD.yml+1 added-1 removed
1 name: CICD2 3 env:4- MIN_SUPPORTED_RUST_VERSION: "1.54.0"4+ MIN_SUPPORTED_RUST_VERSION: "1.57.0"5 CICD_INTERMEDIATES_DIR: "_cicd-intermediates"6 7 on:8 workflow_dispatch:330 unmodified linesmodified:src/export/asciidoc.rs+3 added-5 removed
72 unmodified lines73 let max_str = format_duration_value(result.max, Some(unit)).0;74 let rel_str = format!("{:.2}", entry.relative_speed);75 let rel_stddev_str = if entry.is_fastest {76 "".into()77+ } else if let Some(stddev) = entry.relative_speed_stddev {78+ format!(" ± {:.2}", stddev)79 } else {78- if let Some(stddev) = entry.relative_speed_stddev {79- format!(" ± {:.2}", stddev)80- } else {81- "".into()80+ "".into()82- }81 };82 83 format!(84 "| `{command}` \n\200 unmodified linesmodified:src/export/markdown.rs+3 added-5 removed
61 unmodified lines62 let max_str = format_duration_value(result.max, Some(unit)).0;63 let rel_str = format!("{:.2}", entry.relative_speed);64 let rel_stddev_str = if entry.is_fastest {65 "".into()66+ } else if let Some(stddev) = entry.relative_speed_stddev {67+ format!(" ± {:.2}", stddev)68 } else {67- if let Some(stddev) = entry.relative_speed_stddev {68- format!(" ± {:.2}", stddev)69- } else {70- "".into()69+ "".into()71- }70 };71 72 dest.extend(73 format!(221 unmodified linesmodified:src/error.rs+1 added-1 removed
53 unmodified lines54 }55 56 impl Error for ParameterScanError {}57 58-#[derive(Debug)]58+#[derive(Debug, PartialEq)]59 pub enum OptionsError<'a> {60 EmptyRunsRange,61 TooManyCommandNames(usize),62 UnexpectedCommandNameCount(usize, usize),34 unmodified linesmodified:src/main.rs+1 added-1 removed
259 unmodified lines260 Ok(export_manager)261 }262 263 /// Build the commands to benchmark264-fn build_commands<'a>(matches: &'a ArgMatches) -> Vec<Command<'a>> {264+fn build_commands(matches: &ArgMatches) -> Vec<Command> {265 let command_names = matches.values_of("command-name");266 let command_strings = matches.values_of("command").unwrap();267 268 if let Some(args) = matches.values_of("parameter-scan") {186 unmodified linesmodified:src/options.rs+13 added-17 removed
180 unmodified lines181 let s = format!("{}", shell);182 assert_eq!(&s, "shell -x 'aaa bbb'");183 184 let cmd = shell.command();185- // Command::get_program and Command::args are not yet available in stable channel.186- // https://doc.rust-lang.org/std/process/struct.Command.html#method.get_program187- let s = format!("{:?}", cmd);188- assert_eq!(&s, r#""shell" "-x" "aaa bbb""#);185+ assert_eq!(cmd.get_program().to_string_lossy(), "shell");186+ assert_eq!(187+ cmd.get_args()188+ .map(|a| a.to_string_lossy())189+ .collect::<Vec<_>>(),190+ vec!["-x", "aaa bbb"]191+ );192 193 // Error cases194+ assert!(matches!(195+ Shell::parse("shell 'foo").unwrap_err(),196+ OptionsError::ShellParseError(_)197+ ));198 192- match Shell::parse("shell 'foo").unwrap_err() {193- OptionsError::ShellParseError(_) => { /* ok */ }194- e => assert!(false, "Unexpected error: {}", e),195- }199+ assert_eq!(Shell::parse("").unwrap_err(), OptionsError::EmptyShell);200 197- match Shell::parse("").unwrap_err() {198- OptionsError::EmptyShell => { /* ok */ }199- e => assert!(false, "Unexpected error: {}", e),200- }201-202- match Shell::parse("''").unwrap_err() {203- OptionsError::EmptyShell => { /* ok */ }204- e => assert!(false, "Unexpected error: {}", e),205- }201+ assert_eq!(Shell::parse("''").unwrap_err(), OptionsError::EmptyShell);202 }modified:README.md+1 added-1 removed
206 unmodified lines207 ```208 cargo install hyperfine209 ```210 211-Make sure that you use Rust 1.54 or higher.211+Make sure that you use Rust 1.57 or higher.212 213 ### From binaries (Linux, macOS, Windows)214 215 Download the corresponding archive from the [Release page](https://github.com/sharkdp/hyperfine/releases).24 unmodified lines