Fix clippy suggestions

This commit is contained in:
David Peter authored and David Peter committed 2023-03-15 10:13:58 +01:00
1 parent b38bfc894c
commit c44aa1d006
3 files changed
+13 -13

No files matched your search

+6 -6
View File
@@ -62,7 +62,7 @@ fn build_command() -> Command {
.arg( .arg(
Arg::new("runs") Arg::new("runs")
.long("runs") .long("runs")
.conflicts_with_all(&["max-runs", "min-runs"]) .conflicts_with_all(["max-runs", "min-runs"])
.short('r') .short('r')
.action(ArgAction::Set) .action(ArgAction::Set)
.value_name("NUM") .value_name("NUM")
@@ -116,7 +116,7 @@ fn build_command() -> Command {
.short('P') .short('P')
.action(ArgAction::Set) .action(ArgAction::Set)
.allow_hyphen_values(true) .allow_hyphen_values(true)
.value_names(&["VAR", "MIN", "MAX"]) .value_names(["VAR", "MIN", "MAX"])
.help( .help(
"Perform benchmark runs for each value in the range MIN..MAX. Replaces the \ "Perform benchmark runs for each value in the range MIN..MAX. Replaces the \
string '{VAR}' in each command by the current parameter value.\n\n \ string '{VAR}' in each command by the current parameter value.\n\n \
@@ -133,7 +133,7 @@ fn build_command() -> Command {
.long("parameter-step-size") .long("parameter-step-size")
.short('D') .short('D')
.action(ArgAction::Set) .action(ArgAction::Set)
.value_names(&["DELTA"]) .value_names(["DELTA"])
.requires("parameter-scan") .requires("parameter-scan")
.help( .help(
"This argument requires --parameter-scan to be specified as well. \ "This argument requires --parameter-scan to be specified as well. \
@@ -148,8 +148,8 @@ fn build_command() -> Command {
.short('L') .short('L')
.action(ArgAction::Append) .action(ArgAction::Append)
.allow_hyphen_values(true) .allow_hyphen_values(true)
.value_names(&["VAR", "VALUES"]) .value_names(["VAR", "VALUES"])
.conflicts_with_all(&["parameter-scan", "parameter-step-size"]) .conflicts_with_all(["parameter-scan", "parameter-step-size"])
.help( .help(
"Perform benchmark runs for each value in the comma-separated list VALUES. \ "Perform benchmark runs for each value in the comma-separated list VALUES. \
Replaces the string '{VAR}' in each command by the current parameter value\ Replaces the string '{VAR}' in each command by the current parameter value\
@@ -193,7 +193,7 @@ fn build_command() -> Command {
Arg::new("no-shell") Arg::new("no-shell")
.short('N') .short('N')
.action(ArgAction::SetTrue) .action(ArgAction::SetTrue)
.conflicts_with_all(&["shell", "debug-mode"]) .conflicts_with_all(["shell", "debug-mode"])
.help("An alias for '--shell=none'.") .help("An alias for '--shell=none'.")
) )
.arg( .arg(
+5 -5
View File
@@ -80,11 +80,11 @@ impl ExportManager {
/// Add an additional exporter to the ExportManager /// Add an additional exporter to the ExportManager
pub fn add_exporter(&mut self, export_type: ExportType, filename: &str) -> Result<()> { pub fn add_exporter(&mut self, export_type: ExportType, filename: &str) -> Result<()> {
let exporter: Box<dyn Exporter> = match export_type { let exporter: Box<dyn Exporter> = match export_type {
ExportType::Asciidoc => Box::new(AsciidocExporter::default()), ExportType::Asciidoc => Box::<AsciidocExporter>::default(),
ExportType::Csv => Box::new(CsvExporter::default()), ExportType::Csv => Box::<CsvExporter>::default(),
ExportType::Json => Box::new(JsonExporter::default()), ExportType::Json => Box::<JsonExporter>::default(),
ExportType::Markdown => Box::new(MarkdownExporter::default()), ExportType::Markdown => Box::<MarkdownExporter>::default(),
ExportType::Orgmode => Box::new(OrgmodeExporter::default()), ExportType::Orgmode => Box::<OrgmodeExporter>::default(),
}; };
self.exporters.push(ExporterWithFilename { self.exporters.push(ExporterWithFilename {
+2 -2
View File
@@ -131,7 +131,7 @@ impl CommandInputPolicy {
CommandInputPolicy::Null => Stdio::null(), CommandInputPolicy::Null => Stdio::null(),
CommandInputPolicy::File(path) => { CommandInputPolicy::File(path) => {
let file: File = File::open(&path)?; let file: File = File::open(path)?;
Stdio::from(file) Stdio::from(file)
} }
}; };
@@ -171,7 +171,7 @@ impl CommandOutputPolicy {
CommandOutputPolicy::Pipe => (Stdio::piped(), Stdio::null()), CommandOutputPolicy::Pipe => (Stdio::piped(), Stdio::null()),
CommandOutputPolicy::File(path) => { CommandOutputPolicy::File(path) => {
let file = File::create(&path)?; let file = File::create(path)?;
(file.into(), Stdio::null()) (file.into(), Stdio::null())
} }