Skip to content

Commit

Permalink
Simply the special-case logic
Browse files Browse the repository at this point in the history
  • Loading branch information
samtay committed Dec 24, 2023
1 parent 8ff78fe commit e811742
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,12 @@ impl<'a> OverflowableItem<'a> {
OverflowableItem::NestedMetaItem(..) => SPECIAL_CASE_ATTR,
_ => &[],
};
let additional_cases = if config.version() == Version::Two {
self.special_cases_v2()
} else {
&[]
let additional_cases = match (self, config.version()) {
(OverflowableItem::MacroArg(..), Version::Two) => SPECIAL_CASE_MACROS_V2,
_ => &[],
};
base_cases.iter().chain(additional_cases)
}

fn special_cases_v2(&self) -> &'static [(&'static str, usize)] {
match self {
OverflowableItem::MacroArg(..) => SPECIAL_CASE_MACROS_V2,
_ => &[],
}
}
}

pub(crate) trait IntoOverflowableItem<'a>: Rewrite + Spanned {
Expand Down

0 comments on commit e811742

Please sign in to comment.