From 1bbfa966880d79a5f501c410e2e4570b6dba4f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fern=C3=A1ndez?= Date: Sat, 12 Oct 2024 12:35:33 +0200 Subject: [PATCH 1/2] Fix code scan issues --- src/appconfig.rs | 5 +---- src/rotator.rs | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/appconfig.rs b/src/appconfig.rs index dcd52b4..0104522 100644 --- a/src/appconfig.rs +++ b/src/appconfig.rs @@ -99,10 +99,7 @@ impl AppConfig { // Manage value on events->watcher value let events_watcher = match yaml[0]["events"]["watcher"].as_str() { - Some(value) => match value { - "poll"|"P"|"POLL"|"Poll" => String::from("Poll"), - _ => String::from("Recommended") - }, + Some("poll"|"P"|"POLL"|"Poll") => String::from("Poll"), _ => String::from("Recommended") }; diff --git a/src/rotator.rs b/src/rotator.rs index 01ec428..8eb3d81 100644 --- a/src/rotator.rs +++ b/src/rotator.rs @@ -174,7 +174,6 @@ fn rotate_file(filepath: &str, iteration: u32, lock: Mutex){ // ---------------------------------------------------------------------------- -#[cfg(not(tarpaulin_include))] pub fn rotator(cfg: AppConfig){ loop{ let log_size = if Path::new(cfg.clone().log_file.as_str()).exists() { From 9e1794d829a7c61a3e7d22b3aa131002199153c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fern=C3=A1ndez?= Date: Sat, 12 Oct 2024 13:03:31 +0200 Subject: [PATCH 2/2] Solved tarpaulin warning --- Cargo.toml | 3 +++ src/rotator.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 76e531d..87411f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,3 +40,6 @@ tar = "0.4.40" [dev-dependencies] tokio-test = "*" + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ["cfg(tarpaulin_include)"] } \ No newline at end of file diff --git a/src/rotator.rs b/src/rotator.rs index 8eb3d81..01ec428 100644 --- a/src/rotator.rs +++ b/src/rotator.rs @@ -174,6 +174,7 @@ fn rotate_file(filepath: &str, iteration: u32, lock: Mutex){ // ---------------------------------------------------------------------------- +#[cfg(not(tarpaulin_include))] pub fn rotator(cfg: AppConfig){ loop{ let log_size = if Path::new(cfg.clone().log_file.as_str()).exists() {