From 8ecee79aa7e3338828e2e47a50a5af6b1bac9df9 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Tue, 5 Oct 2021 22:06:53 +0200 Subject: [PATCH] fix(migrate): fix warnings --- espanso-migrate/src/convert.rs | 7 ++++--- espanso-migrate/src/lib.rs | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/espanso-migrate/src/convert.rs b/espanso-migrate/src/convert.rs index 6322ec3..0368b6d 100644 --- a/espanso-migrate/src/convert.rs +++ b/espanso-migrate/src/convert.rs @@ -196,8 +196,9 @@ pub fn convert(input_files: HashMap) -> HashMap) -> Vec { let mut files: Vec = input_files.iter().map(|(key, _)| key.clone()).collect(); files.sort_by(|f1, f2| { - let f1_slashes = f1.matches("/").count(); - let f2_slashes = f2.matches("/").count(); + let f1_slashes = f1.matches('/').count(); + let f2_slashes = f2.matches('/').count(); + #[allow(clippy::comparison_chain)] if f1_slashes > f2_slashes { Ordering::Greater } else if f1_slashes < f2_slashes { @@ -254,7 +255,7 @@ fn yaml_get_string<'a>(yaml: &'a Hash, name: &str) -> Option<&'a str> { .and_then(|v| v.as_str()) } -fn yaml_get_bool<'a>(yaml: &'a Hash, name: &str) -> Option { +fn yaml_get_bool(yaml: &Hash, name: &str) -> Option { yaml .get(&Yaml::String(name.to_string())) .and_then(|v| v.as_bool()) diff --git a/espanso-migrate/src/lib.rs b/espanso-migrate/src/lib.rs index c8d5cce..1208053 100644 --- a/espanso-migrate/src/lib.rs +++ b/espanso-migrate/src/lib.rs @@ -17,13 +17,16 @@ * along with espanso. If not, see . */ +#[allow(unused_imports)] #[macro_use] extern crate lazy_static; +#[allow(unused_imports)] #[macro_use] #[cfg(test)] extern crate include_dir; +#[allow(unused_imports)] #[macro_use] #[cfg(test)] extern crate test_case; @@ -198,6 +201,7 @@ mod tests { static ALL_PARAMS_CASE: Dir = include_dir!("test/all_params"); static OTHER_DIRS_CASE: Dir = include_dir!("test/other_dirs"); + #[allow(clippy::unused_unit)] #[test_case(&SIMPLE_CASE; "simple case")] #[test_case(&BASE_CASE; "base case")] #[test_case(&ALL_PARAMS_CASE; "all config parameters case")] @@ -217,7 +221,7 @@ mod tests { for (file, converted) in to_sorted_list(converted_files) { assert_peq!( to_sorted_hash(&converted), - to_sorted_hash(&expected_files.get(&file).unwrap()) + to_sorted_hash(expected_files.get(&file).unwrap()) ); }