mirror of
https://github.com/sharkdp/hyperfine.git
synced 2024-09-11 22:17:46 +03:00
Fix clippy suggestions
This commit is contained in:
parent
88870c13c2
commit
de78139aea
12
src/cli.rs
12
src/cli.rs
@ -62,7 +62,7 @@ fn build_command() -> Command {
|
||||
.arg(
|
||||
Arg::new("runs")
|
||||
.long("runs")
|
||||
.conflicts_with_all(&["max-runs", "min-runs"])
|
||||
.conflicts_with_all(["max-runs", "min-runs"])
|
||||
.short('r')
|
||||
.action(ArgAction::Set)
|
||||
.value_name("NUM")
|
||||
@ -116,7 +116,7 @@ fn build_command() -> Command {
|
||||
.short('P')
|
||||
.action(ArgAction::Set)
|
||||
.allow_hyphen_values(true)
|
||||
.value_names(&["VAR", "MIN", "MAX"])
|
||||
.value_names(["VAR", "MIN", "MAX"])
|
||||
.help(
|
||||
"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 \
|
||||
@ -133,7 +133,7 @@ fn build_command() -> Command {
|
||||
.long("parameter-step-size")
|
||||
.short('D')
|
||||
.action(ArgAction::Set)
|
||||
.value_names(&["DELTA"])
|
||||
.value_names(["DELTA"])
|
||||
.requires("parameter-scan")
|
||||
.help(
|
||||
"This argument requires --parameter-scan to be specified as well. \
|
||||
@ -148,8 +148,8 @@ fn build_command() -> Command {
|
||||
.short('L')
|
||||
.action(ArgAction::Append)
|
||||
.allow_hyphen_values(true)
|
||||
.value_names(&["VAR", "VALUES"])
|
||||
.conflicts_with_all(&["parameter-scan", "parameter-step-size"])
|
||||
.value_names(["VAR", "VALUES"])
|
||||
.conflicts_with_all(["parameter-scan", "parameter-step-size"])
|
||||
.help(
|
||||
"Perform benchmark runs for each value in the comma-separated list VALUES. \
|
||||
Replaces the string '{VAR}' in each command by the current parameter value\
|
||||
@ -193,7 +193,7 @@ fn build_command() -> Command {
|
||||
Arg::new("no-shell")
|
||||
.short('N')
|
||||
.action(ArgAction::SetTrue)
|
||||
.conflicts_with_all(&["shell", "debug-mode"])
|
||||
.conflicts_with_all(["shell", "debug-mode"])
|
||||
.help("An alias for '--shell=none'.")
|
||||
)
|
||||
.arg(
|
||||
|
@ -80,11 +80,11 @@ impl ExportManager {
|
||||
/// Add an additional exporter to the ExportManager
|
||||
pub fn add_exporter(&mut self, export_type: ExportType, filename: &str) -> Result<()> {
|
||||
let exporter: Box<dyn Exporter> = match export_type {
|
||||
ExportType::Asciidoc => Box::new(AsciidocExporter::default()),
|
||||
ExportType::Csv => Box::new(CsvExporter::default()),
|
||||
ExportType::Json => Box::new(JsonExporter::default()),
|
||||
ExportType::Markdown => Box::new(MarkdownExporter::default()),
|
||||
ExportType::Orgmode => Box::new(OrgmodeExporter::default()),
|
||||
ExportType::Asciidoc => Box::<AsciidocExporter>::default(),
|
||||
ExportType::Csv => Box::<CsvExporter>::default(),
|
||||
ExportType::Json => Box::<JsonExporter>::default(),
|
||||
ExportType::Markdown => Box::<MarkdownExporter>::default(),
|
||||
ExportType::Orgmode => Box::<OrgmodeExporter>::default(),
|
||||
};
|
||||
|
||||
self.exporters.push(ExporterWithFilename {
|
||||
|
@ -131,7 +131,7 @@ impl CommandInputPolicy {
|
||||
CommandInputPolicy::Null => Stdio::null(),
|
||||
|
||||
CommandInputPolicy::File(path) => {
|
||||
let file: File = File::open(&path)?;
|
||||
let file: File = File::open(path)?;
|
||||
Stdio::from(file)
|
||||
}
|
||||
};
|
||||
@ -171,7 +171,7 @@ impl CommandOutputPolicy {
|
||||
CommandOutputPolicy::Pipe => (Stdio::piped(), Stdio::null()),
|
||||
|
||||
CommandOutputPolicy::File(path) => {
|
||||
let file = File::create(&path)?;
|
||||
let file = File::create(path)?;
|
||||
(file.into(), Stdio::null())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user