From f2bfedd3a64cf686bc3436d40492541a813382f9 Mon Sep 17 00:00:00 2001 From: rhysd Date: Mon, 4 Oct 2021 23:07:38 +0900 Subject: [PATCH] Fix clippy warnings --- src/export/mod.rs | 6 ++++-- src/main.rs | 2 +- src/options.rs | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/export/mod.rs b/src/export/mod.rs index aa27185..c4dc887 100644 --- a/src/export/mod.rs +++ b/src/export/mod.rs @@ -46,14 +46,16 @@ pub struct ExportManager { exporters: Vec, } -impl ExportManager { +impl Default for ExportManager { /// Create a new ExportManager - pub fn new() -> ExportManager { + fn default() -> ExportManager { ExportManager { exporters: Vec::new(), } } +} +impl ExportManager { /// Add an additional exporter to the ExportManager pub fn add_exporter(&mut self, export_type: ExportType, filename: &str) -> Result<()> { let _ = File::create(filename)?; diff --git a/src/main.rs b/src/main.rs index a5c0482..cfd933a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -249,7 +249,7 @@ fn build_hyperfine_options<'a>( /// Build the ExportManager that will export the results specified /// in the given ArgMatches fn build_export_manager(matches: &ArgMatches<'_>) -> io::Result { - let mut export_manager = ExportManager::new(); + let mut export_manager = ExportManager::default(); { let mut add_exporter = |flag, exporttype| -> io::Result<()> { if let Some(filename) = matches.value_of(flag) { diff --git a/src/options.rs b/src/options.rs index f3eafc3..20706b7 100644 --- a/src/options.rs +++ b/src/options.rs @@ -37,7 +37,7 @@ impl fmt::Display for Shell { impl Shell { /// Parse given string as shell command line pub fn parse<'a>(s: &str) -> Result> { - let v = shell_words::split(s.as_ref()).map_err(OptionsError::ShellParseError)?; + let v = shell_words::split(s).map_err(OptionsError::ShellParseError)?; if v.is_empty() || v[0].is_empty() { return Err(OptionsError::EmptyShell); }