From f91c4ce73786a69e4ec72f69ef4d9d5f03ac5886 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 28 Aug 2022 13:24:39 +0200 Subject: style: add rustfmt config options --- macros/src/injectable_impl.rs | 3 +-- macros/src/lib.rs | 33 ++++++++++++------------- macros/src/libs/intertrait_macros/gen_caster.rs | 7 ++---- 3 files changed, 19 insertions(+), 24 deletions(-) (limited to 'macros/src') diff --git a/macros/src/injectable_impl.rs b/macros/src/injectable_impl.rs index 6edcab3..990b148 100644 --- a/macros/src/injectable_impl.rs +++ b/macros/src/injectable_impl.rs @@ -2,8 +2,7 @@ use std::error::Error; use quote::{format_ident, quote, ToTokens}; use syn::parse::{Parse, ParseStream}; -use syn::Generics; -use syn::{parse_str, ExprMethodCall, FnArg, ItemImpl, Type}; +use syn::{parse_str, ExprMethodCall, FnArg, Generics, ItemImpl, Type}; use crate::dependency::Dependency; use crate::util::item_impl::find_impl_method_by_name_mut; diff --git a/macros/src/lib.rs b/macros/src/lib.rs index c7157c8..6e3fc0a 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -29,7 +29,8 @@ use libs::intertrait_macros::gen_caster::generate_caster; /// * (Zero or more) Flags wrapped in curly braces. Like `{ a = true, b = false }` /// /// # Flags -/// - `no_doc_hidden` - Don't hide the impl of the [`Injectable`] trait from documentation. +/// - `no_doc_hidden` - Don't hide the impl of the [`Injectable`] trait from +/// documentation. /// /// # Panics /// If the attributed item is not a impl. @@ -68,14 +69,15 @@ use libs::intertrait_macros::gen_caster::generate_caster; /// impl Knight /// { /// pub fn new( -/// #[named("tough")] -/// tough_armor: TransientPtr, +/// #[named("tough")] tough_armor: TransientPtr, /// -/// #[named("light")] -/// light_armor: TransientPtr +/// #[named("light")] light_armor: TransientPtr, /// ) -> Self /// { -/// Self { tough_armor, light_armor } +/// Self { +/// tough_armor, +/// light_armor, +/// } /// } /// } /// # @@ -145,8 +147,8 @@ pub fn injectable(args_stream: TokenStream, impl_stream: TokenStream) -> TokenSt /// ``` /// use std::collections::HashMap; /// -/// use syrette::interfaces::factory::IFactory; /// use syrette::factory; +/// use syrette::interfaces::factory::IFactory; /// /// enum ConfigValue /// { @@ -161,7 +163,8 @@ pub fn injectable(args_stream: TokenStream, impl_stream: TokenStream) -> TokenSt /// fn configure(&self, key: String, value: ConfigValue); /// } /// -/// struct Configurator { +/// struct Configurator +/// { /// config: HashMap, /// } /// @@ -171,11 +174,10 @@ pub fn injectable(args_stream: TokenStream, impl_stream: TokenStream) -> TokenSt /// { /// Self { /// config: HashMap::from( -/// keys -/// .iter() +/// keys.iter() /// .map(|key| (key.clone(), ConfigValue::None)) -/// .collect::>() -/// ) +/// .collect::>(), +/// ), /// } /// } /// } @@ -226,7 +228,6 @@ pub fn factory(_: TokenStream, type_alias_stream: TokenStream) -> TokenStream /// /// # Arguments /// {Implementation} -> {Interface} -/// #[proc_macro] pub fn declare_interface(input: TokenStream) -> TokenStream { @@ -265,11 +266,9 @@ pub fn declare_interface(input: TokenStream) -> TokenStream /// impl Ninja /// { /// pub fn new( -/// #[syrette::named("strong")] -/// strong_weapon: TransientPtr, +/// #[syrette::named("strong")] strong_weapon: TransientPtr, /// -/// #[syrette::named("weak")] -/// weak_weapon: TransientPtr, +/// #[syrette::named("weak")] weak_weapon: TransientPtr, /// ) -> Self /// { /// Self { diff --git a/macros/src/libs/intertrait_macros/gen_caster.rs b/macros/src/libs/intertrait_macros/gen_caster.rs index d77262a..9bac09e 100644 --- a/macros/src/libs/intertrait_macros/gen_caster.rs +++ b/macros/src/libs/intertrait_macros/gen_caster.rs @@ -13,11 +13,8 @@ */ use std::str::from_utf8; -use proc_macro2::Ident; -use proc_macro2::TokenStream; -use quote::format_ident; -use quote::quote; -use quote::ToTokens; +use proc_macro2::{Ident, TokenStream}; +use quote::{format_ident, quote, ToTokens}; use uuid::adapter::Simple; use uuid::Uuid; -- cgit v1.2.3-18-g5258