We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7cfd7d3 commit 9e3f748Copy full SHA for 9e3f748
compiler/rustc_expand/src/mbe/macro_rules.rs
@@ -894,12 +894,12 @@ fn check_redundant_vis_repetition(
894
seq: &SequenceRepetition,
895
span: &DelimSpan,
896
) {
897
- let is_zero_or_one: bool = seq.kleene.op == KleeneOp::ZeroOrOne;
898
- let is_vis = seq.tts.first().map_or(false, |tt| {
899
- matches!(tt, mbe::TokenTree::MetaVarDecl { kind: NonterminalKind::Vis, .. })
900
- });
901
-
902
- if is_vis && is_zero_or_one {
+ if seq.kleene.op == KleeneOp::ZeroOrOne
+ && matches!(
+ seq.tts.first(),
+ Some(mbe::TokenTree::MetaVarDecl { kind: NonterminalKind::Vis, .. })
+ )
+ {
903
err.note("a `vis` fragment can already be empty");
904
err.multipart_suggestion(
905
"remove the `$(` and `)?`",
0 commit comments