From 41a179ba9fb1e716447fb80062992e84ae6b8861 Mon Sep 17 00:00:00 2001 From: ChengyuZhu6 Date: Tue, 29 Oct 2024 09:35:54 +0800 Subject: [PATCH 1/2] Fix typos Fix typos related to with_spec_dirs Signed-off-by: ChengyuZhu6 --- src/annotations.rs | 2 +- src/spec_dirs.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/annotations.rs b/src/annotations.rs index f7a0d03..81f899d 100644 --- a/src/annotations.rs +++ b/src/annotations.rs @@ -13,7 +13,7 @@ const MAX_NAME_LEN: usize = 63; // be in the format of "vendor.device-type". #[allow(dead_code)] pub(crate) fn update_annotations( - option_annotaions: Option>, + option_annotations: Option>, plugin_name: &str, device_id: &str, devices: Vec, diff --git a/src/spec_dirs.rs b/src/spec_dirs.rs index e550fd3..5a956bd 100644 --- a/src/spec_dirs.rs +++ b/src/spec_dirs.rs @@ -23,7 +23,7 @@ lazy_static! { // DEFAULT_SPEC_DIRS is the default Spec directory configuration. // While altering this variable changes the package defaults, // the preferred way of overriding the default directories is - // to use a WithSpecDirs options. Otherwise the change is only + // to use a with_spec_dirs options. Otherwise the change is only // effective if it takes place before creating the Registry or // other Cache instances. pub static ref DEFAULT_SPEC_DIRS: &'static [&'static str] = &[ From 4b97986abdc18e29fb4792fd4e7854662ca1a9fd Mon Sep 17 00:00:00 2001 From: ChengyuZhu6 Date: Wed, 30 Oct 2024 08:55:13 +0800 Subject: [PATCH 2/2] fix clippy check error use `unwrap_or_default` to fix clippy check error. Signed-off-by: ChengyuZhu6 --- src/annotations.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/annotations.rs b/src/annotations.rs index 81f899d..fa61e6c 100644 --- a/src/annotations.rs +++ b/src/annotations.rs @@ -18,7 +18,7 @@ pub(crate) fn update_annotations( device_id: &str, devices: Vec, ) -> Result> { - let mut annotations = option_annotations.unwrap_or_else(HashMap::new); + let mut annotations = option_annotations.unwrap_or_default(); let key = annotation_key(plugin_name, device_id).context("CDI annotation key failed")?; if annotations.contains_key(&key) {