Skip to content

Commit

Permalink
Remove FilterAttrs trait when unused
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Feb 8, 2024
1 parent 7dcfac7 commit dc9cf16
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/attr.rs
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down Expand Up @@ -582,13 +584,16 @@ impl MetaList {
}
}

#[cfg(feature = "printing")]
pub(crate) trait FilterAttrs<'a> {
type Ret: Iterator<Item = &'a Attribute>;

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<slice::Iter<'a, Attribute>, fn(&&Attribute) -> bool>;

Expand All @@ -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 {
Expand Down

0 comments on commit dc9cf16

Please sign in to comment.