diff options
author | HampusM <hampus@hampusmat.com> | 2022-10-03 20:23:26 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-10-03 20:45:32 +0200 |
commit | 97c789e38bb8e61389a3808d241689e623144344 (patch) | |
tree | 4cbaee424bfcb1b69a523be9664e48e5264f3d4b /macros/src/lib.rs | |
parent | 03d3898a05592eb83b7a16609dba46d0b293790e (diff) |
refactor: remove relying on Rust nightly for better handling of features
Diffstat (limited to 'macros/src/lib.rs')
-rw-r--r-- | macros/src/lib.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 8e906d0..293ac06 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -1,5 +1,4 @@ #![cfg_attr(doc_cfg, feature(doc_cfg))] -#![feature(proc_macro_hygiene)] #![deny(clippy::all)] #![deny(clippy::pedantic)] #![allow(clippy::module_name_repetitions)] @@ -7,7 +6,6 @@ //! Macros for the [Syrette](https://crates.io/crates/syrette) crate. -use feature_macros::feature_specific; use proc_macro::TokenStream; use quote::quote; use syn::{parse, parse_macro_input}; @@ -18,10 +16,12 @@ mod libs; mod macro_flag; mod util; -#[feature_specific("factory")] +#[cfg(feature = "factory")] +#[cfg_attr(doc_cfg, doc(cfg(feature = "factory")))] mod factory; -#[feature_specific("factory")] +#[cfg(feature = "factory")] +#[cfg_attr(doc_cfg, doc(cfg(feature = "factory")))] mod fn_trait; use crate::declare_interface_args::DeclareInterfaceArgs; @@ -193,7 +193,8 @@ pub fn injectable(args_stream: TokenStream, impl_stream: TokenStream) -> TokenSt /// ``` /// /// [`TransientPtr`]: https://docs.rs/syrette/latest/syrette/ptr/type.TransientPtr.html -#[feature_specific("factory")] +#[cfg(feature = "factory")] +#[cfg_attr(doc_cfg, doc(cfg(feature = "factory")))] #[proc_macro_attribute] pub fn factory(args_stream: TokenStream, type_alias_stream: TokenStream) -> TokenStream { @@ -291,7 +292,8 @@ pub fn factory(args_stream: TokenStream, type_alias_stream: TokenStream) -> Toke /// declare_default_factory!(dyn IParser); /// ``` #[proc_macro] -#[feature_specific("factory")] +#[cfg(feature = "factory")] +#[cfg_attr(doc_cfg, doc(cfg(feature = "factory")))] pub fn declare_default_factory(args_stream: TokenStream) -> TokenStream { use syn::parse_str; |