From 56e141a8a5da4e86cdbb5a82c8820d2ce91dd013 Mon Sep 17 00:00:00 2001 From: Dmitry Ivanov <ivadmi5@gmail.com> Date: Wed, 16 Oct 2024 03:48:43 +0300 Subject: [PATCH] chore: fix warnings reported by clippy 1.81 --- Makefile | 4 ++-- src/plugin/manager.rs | 14 ++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index d098717abb..8b51d539b8 100644 --- a/Makefile +++ b/Makefile @@ -53,8 +53,8 @@ lint: cargo clippy --version cargo clippy \ - $(LOCKED) $(MAKE_JOBSERVER_ARGS) \ - --features=load_test,error_injection,webui \ + $(LOCKED) $(MAKE_JOBSERVER_ARGS) $(CARGO_FLAGS) \ + --features=load_test,error_injection \ -- --deny clippy::all --no-deps RUSTDOCFLAGS="-Dwarnings -Arustdoc::private_intra_doc_links" \ diff --git a/src/plugin/manager.rs b/src/plugin/manager.rs index 5558d370e7..135dbaff42 100644 --- a/src/plugin/manager.rs +++ b/src/plugin/manager.rs @@ -102,21 +102,15 @@ impl PluginManager { fn load_so(path: &Path) -> Option<Rc<LibraryWrapper>> { // filter files by its extension - let Some(ext) = path.extension() else { - return None; - }; + let ext = path.extension()?; if !Self::AVAILABLE_EXT.contains(&ext.to_string_lossy().as_ref()) { return None; } // trying to load a dynamic library - let lib = match unsafe { LibraryWrapper::new(path.to_path_buf()) } { - Ok(lib) => lib, - Err(e) => { - tlog!(Warning, "error while open plugin candidate: {e}"); - return None; - } - }; + let lib = unsafe { LibraryWrapper::new(path.to_path_buf()) } + .inspect_err(|e| tlog!(Warning, "error while open plugin candidate: {e}")) + .ok()?; Some(Rc::new(lib)) } -- GitLab