Fix some more clippy warnings
This commit is contained in:
parent
388ef34904
commit
bfecb18771
16 changed files with 71 additions and 97 deletions
|
@ -102,10 +102,7 @@ impl TokenTree {
|
|||
|
||||
/// Returns `true` if the given token tree is delimited.
|
||||
fn is_delimited(&self) -> bool {
|
||||
match *self {
|
||||
TokenTree::Delimited(..) => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(*self, TokenTree::Delimited(..))
|
||||
}
|
||||
|
||||
/// Returns `true` if the given token tree is a token of the given kind.
|
||||
|
|
|
@ -134,10 +134,7 @@ enum Stack<'a, T> {
|
|||
impl<'a, T> Stack<'a, T> {
|
||||
/// Returns whether a stack is empty.
|
||||
fn is_empty(&self) -> bool {
|
||||
match *self {
|
||||
Stack::Empty => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(*self, Stack::Empty)
|
||||
}
|
||||
|
||||
/// Returns a new stack with an element of top.
|
||||
|
|
|
@ -1036,17 +1036,16 @@ fn token_can_be_followed_by_any(tok: &mbe::TokenTree) -> bool {
|
|||
/// a fragment specifier (indeed, these fragments can be followed by
|
||||
/// ANYTHING without fear of future compatibility hazards).
|
||||
fn frag_can_be_followed_by_any(kind: NonterminalKind) -> bool {
|
||||
match kind {
|
||||
matches!(
|
||||
kind,
|
||||
NonterminalKind::Item // always terminated by `}` or `;`
|
||||
| NonterminalKind::Block // exactly one token tree
|
||||
| NonterminalKind::Ident // exactly one token tree
|
||||
| NonterminalKind::Literal // exactly one token tree
|
||||
| NonterminalKind::Meta // exactly one token tree
|
||||
| NonterminalKind::Lifetime // exactly one token tree
|
||||
| NonterminalKind::TT => true, // exactly one token tree
|
||||
|
||||
_ => false,
|
||||
}
|
||||
| NonterminalKind::TT // exactly one token tree
|
||||
)
|
||||
}
|
||||
|
||||
enum IsInFollow {
|
||||
|
|
|
@ -345,10 +345,10 @@ impl<'a, 'b> MutVisitor for PlaceholderExpander<'a, 'b> {
|
|||
|
||||
fn visit_mod(&mut self, module: &mut ast::Mod) {
|
||||
noop_visit_mod(module, self);
|
||||
module.items.retain(|item| match item.kind {
|
||||
ast::ItemKind::MacCall(_) if !self.cx.ecfg.keep_macs => false, // remove macro definitions
|
||||
_ => true,
|
||||
});
|
||||
// remove macro definitions
|
||||
module.items.retain(
|
||||
|item| !matches!(item.kind, ast::ItemKind::MacCall(_) if !self.cx.ecfg.keep_macs),
|
||||
);
|
||||
}
|
||||
|
||||
fn visit_mac(&mut self, _mac: &mut ast::MacCall) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue