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 --- syrette_macros/src/factory_type_alias.rs | 1 + syrette_macros/src/injectable_impl.rs | 3 ++- syrette_macros/src/lib.rs | 9 +++++++++ syrette_macros/src/libs/intertrait_macros/gen_caster.rs | 8 ++++---- syrette_macros/src/libs/intertrait_macros/mod.rs | 8 ++++---- 5 files changed, 20 insertions(+), 9 deletions(-) (limited to 'syrette_macros') diff --git a/syrette_macros/src/factory_type_alias.rs b/syrette_macros/src/factory_type_alias.rs index 82e2315..8ea7baa 100644 --- a/syrette_macros/src/factory_type_alias.rs +++ b/syrette_macros/src/factory_type_alias.rs @@ -11,6 +11,7 @@ pub struct FactoryTypeAlias impl Parse for FactoryTypeAlias { + #[allow(clippy::match_wildcard_for_single_variants)] fn parse(input: ParseStream) -> syn::Result { let type_alias = match input.parse::() { diff --git a/syrette_macros/src/injectable_impl.rs b/syrette_macros/src/injectable_impl.rs index e7d1b54..3000253 100644 --- a/syrette_macros/src/injectable_impl.rs +++ b/syrette_macros/src/injectable_impl.rs @@ -131,6 +131,7 @@ impl InjectableImpl .find(|method_item| method_item.sig.ident == method_name) } + #[allow(clippy::match_wildcard_for_single_variants)] fn get_has_fn_args_self(fn_args: &Punctuated) -> bool { fn_args.iter().any(|arg| match arg { @@ -170,7 +171,7 @@ impl InjectableImpl match opt_colon_two { Some(colon_two) => { - acc.push_str(colon_two.to_token_stream().to_string().as_str()) + acc.push_str(colon_two.to_token_stream().to_string().as_str()); } None => {} } diff --git a/syrette_macros/src/lib.rs b/syrette_macros/src/lib.rs index f686e1e..2981ea7 100644 --- a/syrette_macros/src/lib.rs +++ b/syrette_macros/src/lib.rs @@ -1,3 +1,6 @@ +#![deny(clippy::all)] +#![deny(clippy::pedantic)] + use proc_macro::TokenStream; use quote::quote; use syn::{parse, parse_macro_input}; @@ -20,6 +23,9 @@ use libs::intertrait_macros::gen_caster::generate_caster; /// /// * A interface trait the struct implements. /// +/// # Panics +/// If the attributed item is not a impl. +/// /// # Examples /// ``` /// trait IConfigReader @@ -74,6 +80,9 @@ pub fn injectable(args_stream: TokenStream, impl_stream: TokenStream) -> TokenSt /// Makes a type alias usable as a factory interface. /// +/// # Panics +/// If the attributed item is not a type alias. +/// /// # Examples /// ``` /// trait IUser diff --git a/syrette_macros/src/libs/intertrait_macros/gen_caster.rs b/syrette_macros/src/libs/intertrait_macros/gen_caster.rs index 213a75e..9126200 100644 --- a/syrette_macros/src/libs/intertrait_macros/gen_caster.rs +++ b/syrette_macros/src/libs/intertrait_macros/gen_caster.rs @@ -1,13 +1,13 @@ /** * Originally from Intertrait by CodeChain * - * https://github.com/CodeChain-io/intertrait - * https://crates.io/crates/intertrait/0.2.2 + * + * * * Licensed under either of * - * Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) - * MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) + * Apache License, Version 2.0 (LICENSE-APACHE or ) + * MIT license (LICENSE-MIT or ) * at your option. */ diff --git a/syrette_macros/src/libs/intertrait_macros/mod.rs b/syrette_macros/src/libs/intertrait_macros/mod.rs index da9775a..fa8c021 100644 --- a/syrette_macros/src/libs/intertrait_macros/mod.rs +++ b/syrette_macros/src/libs/intertrait_macros/mod.rs @@ -1,13 +1,13 @@ /** * Originally from Intertrait by CodeChain * - * https://github.com/CodeChain-io/intertrait - * https://crates.io/crates/intertrait/0.2.2 + * + * * * Licensed under either of * - * Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) - * MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) + * Apache License, Version 2.0 (LICENSE-APACHE or ) + * MIT license (LICENSE-MIT or ) * at your option. */ -- cgit v1.2.3-18-g5258