From dc9cf16b9b0601d2d393d059c46a8f8e0220cc21 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 7 Feb 2024 21:10:43 -0800 Subject: [PATCH] Remove FilterAttrs trait when unused --- src/attr.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/attr.rs b/src/attr.rs index b6c4675b76..2859c709fd 100644 --- a/src/attr.rs +++ b/src/attr.rs @@ -1,6 +1,8 @@ use super::*; use proc_macro2::TokenStream; +#[cfg(feature = "printing")] use std::iter; +#[cfg(feature = "printing")] use std::slice; #[cfg(feature = "parsing")] @@ -582,13 +584,16 @@ impl MetaList { } } +#[cfg(feature = "printing")] pub(crate) trait FilterAttrs<'a> { type Ret: Iterator; fn outer(self) -> Self::Ret; + #[cfg(feature = "full")] fn inner(self) -> Self::Ret; } +#[cfg(feature = "printing")] impl<'a> FilterAttrs<'a> for &'a [Attribute] { type Ret = iter::Filter, fn(&&Attribute) -> bool>; @@ -602,6 +607,7 @@ impl<'a> FilterAttrs<'a> for &'a [Attribute] { self.iter().filter(is_outer) } + #[cfg(feature = "full")] fn inner(self) -> Self::Ret { fn is_inner(attr: &&Attribute) -> bool { match attr.style {