From ff71b49f014613729237178f0d3ea374f7d72cd5 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 19 Jul 2022 12:28:34 +0200 Subject: refactor: use aggressive clippy linting --- example/src/main.rs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'example/src/main.rs') diff --git a/example/src/main.rs b/example/src/main.rs index 1f4ddb6..d79a030 100644 --- a/example/src/main.rs +++ b/example/src/main.rs @@ -1,3 +1,6 @@ +#![deny(clippy::all)] +#![deny(clippy::pedantic)] + use syrette::errors::di_container::DIContainerError; use syrette::interfaces::factory::IFactory; use syrette::ptr::{FactoryPtr, InterfacePtr}; @@ -58,14 +61,14 @@ trait ICow struct Cow { - _moo_cnt: i32, + moo_cnt: i32, } impl Cow { fn new(moo_cnt: i32) -> Self { - Self { _moo_cnt: moo_cnt } + Self { moo_cnt } } } @@ -73,7 +76,7 @@ impl ICow for Cow { fn moo(&self) { - for _ in 0..self._moo_cnt { + for _ in 0..self.moo_cnt { println!("Moo"); } } @@ -89,9 +92,9 @@ trait IHuman struct Human { - _dog: InterfacePtr, - _cat: InterfacePtr, - _cow_factory: FactoryPtr, + dog: InterfacePtr, + cat: InterfacePtr, + cow_factory: FactoryPtr, } #[injectable(IHuman)] @@ -104,9 +107,9 @@ impl Human ) -> Self { Self { - _dog: dog, - _cat: cat, - _cow_factory: cow_factory, + dog, + cat, + cow_factory, } } } @@ -117,13 +120,13 @@ impl IHuman for Human { println!("Hi doggy!"); - self._dog.woof(); + self.dog.woof(); println!("Hi kitty!"); - self._cat.meow(); + self.cat.meow(); - let cow: Box = (self._cow_factory)(3); + let cow: Box = (self.cow_factory)(3); cow.moo(); } -- cgit v1.2.3-18-g5258