1
Fork 0

Tweak more warnings.

Much like the previous commit.

I think the removal of "the token" in each message is fine here. There
are many more error messages that mention tokens without saying "the
token" than those that do say it.
This commit is contained in:
Nicholas Nethercote 2024-06-25 12:52:15 +10:00
parent a201fab208
commit dd2b027d5d
50 changed files with 113 additions and 121 deletions

View file

@ -78,11 +78,10 @@ use std::rc::Rc;
pub(crate) use NamedMatch::*;
pub(crate) use ParseResult::*;
use rustc_ast::token::{self, DocComment, NonterminalKind, Token};
use rustc_ast_pretty::pprust;
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::ErrorGuaranteed;
use rustc_lint_defs::pluralize;
use rustc_parse::parser::{ParseNtResult, Parser};
use rustc_parse::parser::{ParseNtResult, Parser, token_descr};
use rustc_span::Span;
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
@ -150,7 +149,7 @@ impl Display for MatcherLoc {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
MatcherLoc::Token { token } | MatcherLoc::SequenceSep { separator: token } => {
write!(f, "`{}`", pprust::token_to_string(token))
write!(f, "{}", token_descr(token))
}
MatcherLoc::MetaVarDecl { bind, kind, .. } => {
write!(f, "meta-variable `${bind}")?;