aboutsummaryrefslogtreecommitdiff
path: root/syrette_macros/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-07-19 12:28:34 +0200
committerHampusM <hampus@hampusmat.com>2022-07-19 12:28:34 +0200
commitff71b49f014613729237178f0d3ea374f7d72cd5 (patch)
tree4d0b320fae52f8318139364d4dcd6b424fea735a /syrette_macros/src
parent58e50e3d9073584064e13edf489fc008b0388149 (diff)
refactor: use aggressive clippy linting
Diffstat (limited to 'syrette_macros/src')
-rw-r--r--syrette_macros/src/factory_type_alias.rs1
-rw-r--r--syrette_macros/src/injectable_impl.rs3
-rw-r--r--syrette_macros/src/lib.rs9
-rw-r--r--syrette_macros/src/libs/intertrait_macros/gen_caster.rs8
-rw-r--r--syrette_macros/src/libs/intertrait_macros/mod.rs8
5 files changed, 20 insertions, 9 deletions
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<Self>
{
let type_alias = match input.parse::<ItemType>() {
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<FnArg, Comma>) -> 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
+ * <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 <http://www.apache.org/licenses/LICENSE-2.0>)
+ * MIT license (LICENSE-MIT or <http://opensource.org/licenses/MIT>)
* 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
+ * <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 <http://www.apache.org/licenses/LICENSE-2.0>)
+ * MIT license (LICENSE-MIT or <http://opensource.org/licenses/MIT>)
* at your option.
*/