Skip to content

Commit 15abc81

Browse files
committed
remove reudndant function param in check_matcher_core()
1 parent 75287dd commit 15abc81

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

compiler/rustc_expand/src/mbe/macro_rules.rs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ pub fn compile_declarative_macro(
478478
)
479479
.pop()
480480
.unwrap();
481-
valid &= check_lhs_nt_follows(&sess.parse_sess, features, &def, &tt);
481+
valid &= check_lhs_nt_follows(&sess.parse_sess, &def, &tt);
482482
return tt;
483483
}
484484
sess.parse_sess.span_diagnostic.span_bug(def.span, "wrong-structured lhs")
@@ -563,16 +563,11 @@ pub fn compile_declarative_macro(
563563
}))
564564
}
565565

566-
fn check_lhs_nt_follows(
567-
sess: &ParseSess,
568-
features: &Features,
569-
def: &ast::Item,
570-
lhs: &mbe::TokenTree,
571-
) -> bool {
566+
fn check_lhs_nt_follows(sess: &ParseSess, def: &ast::Item, lhs: &mbe::TokenTree) -> bool {
572567
// lhs is going to be like TokenTree::Delimited(...), where the
573568
// entire lhs is those tts. Or, it can be a "bare sequence", not wrapped in parens.
574569
if let mbe::TokenTree::Delimited(_, delimited) = lhs {
575-
check_matcher(sess, features, def, &delimited.tts)
570+
check_matcher(sess, def, &delimited.tts)
576571
} else {
577572
let msg = "invalid macro matcher; matchers must be contained in balanced delimiters";
578573
sess.span_diagnostic.span_err(lhs.span(), msg);
@@ -632,16 +627,11 @@ fn check_rhs(sess: &ParseSess, rhs: &mbe::TokenTree) -> bool {
632627
false
633628
}
634629

635-
fn check_matcher(
636-
sess: &ParseSess,
637-
features: &Features,
638-
def: &ast::Item,
639-
matcher: &[mbe::TokenTree],
640-
) -> bool {
630+
fn check_matcher(sess: &ParseSess, def: &ast::Item, matcher: &[mbe::TokenTree]) -> bool {
641631
let first_sets = FirstSets::new(matcher);
642632
let empty_suffix = TokenSet::empty();
643633
let err = sess.span_diagnostic.err_count();
644-
check_matcher_core(sess, features, def, &first_sets, matcher, &empty_suffix);
634+
check_matcher_core(sess, def, &first_sets, matcher, &empty_suffix);
645635
err == sess.span_diagnostic.err_count()
646636
}
647637

@@ -955,7 +945,6 @@ impl<'tt> TokenSet<'tt> {
955945
// see `FirstSets::new`.
956946
fn check_matcher_core<'tt>(
957947
sess: &ParseSess,
958-
features: &Features,
959948
def: &ast::Item,
960949
first_sets: &FirstSets<'tt>,
961950
matcher: &'tt [mbe::TokenTree],
@@ -1008,7 +997,7 @@ fn check_matcher_core<'tt>(
1008997
token::CloseDelim(d.delim),
1009998
span.close,
1010999
));
1011-
check_matcher_core(sess, features, def, first_sets, &d.tts, &my_suffix);
1000+
check_matcher_core(sess, def, first_sets, &d.tts, &my_suffix);
10121001
// don't track non NT tokens
10131002
last.replace_with_irrelevant();
10141003

@@ -1040,8 +1029,7 @@ fn check_matcher_core<'tt>(
10401029
// At this point, `suffix_first` is built, and
10411030
// `my_suffix` is some TokenSet that we can use
10421031
// for checking the interior of `seq_rep`.
1043-
let next =
1044-
check_matcher_core(sess, features, def, first_sets, &seq_rep.tts, my_suffix);
1032+
let next = check_matcher_core(sess, def, first_sets, &seq_rep.tts, my_suffix);
10451033
if next.maybe_empty {
10461034
last.add_all(&next);
10471035
} else {

0 commit comments

Comments
 (0)