From e89600c6f0723259e5d0e45097a8afb6742bd8dc Mon Sep 17 00:00:00 2001 From: samuelOsborne Date: Thu, 1 Aug 2024 10:57:08 +0200 Subject: [PATCH] fix: clippy lints --- Makefile | 6 +- dotlottie-rs/src/dotlottie_player.rs | 66 ++++++++++---------- dotlottie-rs/src/state_machine/states/mod.rs | 1 - dotlottie-rs/tests/autoplay.rs | 1 - 4 files changed, 36 insertions(+), 38 deletions(-) diff --git a/Makefile b/Makefile index e45db345..c4352fcb 100644 --- a/Makefile +++ b/Makefile @@ -973,10 +973,10 @@ bench: .PHONY: clippy clippy: $(info $(YELLOW)Running clippy for workspace$(NC)) - cargo clippy --manifest-path $(CORE)/Cargo.toml --all-targets --all-features + cargo clippy --manifest-path $(CORE)/Cargo.toml --all-targets --all-features -- -D clippy::print_stdout # fms has a lot of clippy warnings and errors, so we're ignoring them for now - # cargo clippy --manifest-path $(FMS)/Cargo.toml --all-targets --all-features - cargo clippy --manifest-path $(RUNTIME_FFI)/Cargo.toml --all-targets --all-features + # cargo clippy --manifest-path $(FMS)/Cargo.toml --all-targets --all-features -- -D clippy::print_stdout + cargo clippy --manifest-path $(RUNTIME_FFI)/Cargo.toml --all-targets --all-features -- -D clippy::print_stdout .PHONY: help help: diff --git a/dotlottie-rs/src/dotlottie_player.rs b/dotlottie-rs/src/dotlottie_player.rs index 909f86eb..da1186c0 100644 --- a/dotlottie-rs/src/dotlottie_player.rs +++ b/dotlottie-rs/src/dotlottie_player.rs @@ -1466,15 +1466,15 @@ impl DotLottiePlayer { match self.state_machine.try_write() { Ok(mut state_machine) => { if let Some(sm) = state_machine.as_mut() { - return sm.post_event(&bool_event); + sm.post_event(&bool_event) } else { - return 1; + 1 } } - Err(_) => return 1, + Err(_) => 1, } } - Err(_) => return 1, + Err(_) => 1, } } "String" => { @@ -1486,12 +1486,12 @@ impl DotLottiePlayer { match self.state_machine.try_write() { Ok(mut state_machine) => { if let Some(sm) = state_machine.as_mut() { - return sm.post_event(&string_event); + sm.post_event(&string_event) } else { - return 1; + 1 } } - Err(_) => return 1, + Err(_) => 1, } } "Numeric" => { @@ -1506,15 +1506,15 @@ impl DotLottiePlayer { match self.state_machine.try_write() { Ok(mut state_machine) => { if let Some(sm) = state_machine.as_mut() { - return sm.post_event(&numeric_event); + sm.post_event(&numeric_event) } else { - return 1; + 1 } } - Err(_) => return 1, + Err(_) => 1, } } - Err(_) => return 1, + Err(_) => 1, } } "OnPointerDown" => { @@ -1529,12 +1529,12 @@ impl DotLottiePlayer { match self.state_machine.try_write() { Ok(mut state_machine) => { if let Some(sm) = state_machine.as_mut() { - return sm.post_event(&pointer_event); + sm.post_event(&pointer_event) } else { - return 1; + 1 } } - Err(_) => return 1, + Err(_) => 1, } } "OnPointerUp" => { @@ -1549,12 +1549,12 @@ impl DotLottiePlayer { match self.state_machine.try_write() { Ok(mut state_machine) => { if let Some(sm) = state_machine.as_mut() { - return sm.post_event(&pointer_event); + sm.post_event(&pointer_event) } else { - return 1; + 1 } } - Err(_) => return 1, + Err(_) => 1, } } "OnPointerMove" => { @@ -1569,12 +1569,12 @@ impl DotLottiePlayer { match self.state_machine.try_write() { Ok(mut state_machine) => { if let Some(sm) = state_machine.as_mut() { - return sm.post_event(&pointer_event); + sm.post_event(&pointer_event) } else { - return 1; + 1 } } - Err(_) => return 1, + Err(_) => 1, } } "OnPointerEnter" => { @@ -1589,12 +1589,12 @@ impl DotLottiePlayer { match self.state_machine.try_write() { Ok(mut state_machine) => { if let Some(sm) = state_machine.as_mut() { - return sm.post_event(&pointer_event); + sm.post_event(&pointer_event) } else { - return 1; + 1 } } - Err(_) => return 1, + Err(_) => 1, } } "OnPointerExit" => { @@ -1606,12 +1606,12 @@ impl DotLottiePlayer { match self.state_machine.try_write() { Ok(mut state_machine) => { if let Some(sm) = state_machine.as_mut() { - return sm.post_event(&pointer_event); + sm.post_event(&pointer_event) } else { - return 1; + 1 } } - Err(_) => return 1, + Err(_) => 1, } } "OnComplete" => { @@ -1620,12 +1620,12 @@ impl DotLottiePlayer { match self.state_machine.try_write() { Ok(mut state_machine) => { if let Some(sm) = state_machine.as_mut() { - return sm.post_event(&pointer_event); + sm.post_event(&pointer_event) } else { - return 1; + 1 } } - Err(_) => return 1, + Err(_) => 1, } } "SetNumericContext" => { @@ -1646,15 +1646,15 @@ impl DotLottiePlayer { match self.state_machine.try_write() { Ok(mut state_machine) => { if let Some(sm) = state_machine.as_mut() { - return sm.post_event(&event); + sm.post_event(&event) } else { - return 1; + 1 } } - Err(_) => return 1, + Err(_) => 1, } } - _ => return 1, + _ => 1, } } diff --git a/dotlottie-rs/src/state_machine/states/mod.rs b/dotlottie-rs/src/state_machine/states/mod.rs index ce41add1..1e45dd0b 100644 --- a/dotlottie-rs/src/state_machine/states/mod.rs +++ b/dotlottie-rs/src/state_machine/states/mod.rs @@ -130,7 +130,6 @@ impl StateTrait for State { if ret { return 4; } - println!(">> Set frame failed"); } } } diff --git a/dotlottie-rs/tests/autoplay.rs b/dotlottie-rs/tests/autoplay.rs index 7488e238..832c6bf8 100644 --- a/dotlottie-rs/tests/autoplay.rs +++ b/dotlottie-rs/tests/autoplay.rs @@ -52,7 +52,6 @@ mod tests { } assert!(!rendered_frames.is_empty()); - println!("Rendered frames: {:?}", rendered_frames.len()); } #[test]