Rollup merge of #89991 - petrochenkov:visitok2, r=jackh726

rustc_ast: Turn `MutVisitor::token_visiting_enabled` into a constant

It's a visitor property rather than something that needs to be determined at runtime
This commit is contained in:
Yuki Okushi 2021-10-22 19:42:48 +09:00 committed by GitHub
commit cbebdd8e67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 13 deletions

View file

@ -19,9 +19,7 @@ use std::mem;
struct Marker(LocalExpnId, Transparency);
impl MutVisitor for Marker {
fn token_visiting_enabled(&self) -> bool {
true
}
const VISIT_TOKENS: bool = true;
fn visit_span(&mut self, span: &mut Span) {
*span = span.apply_mark(self.0.to_expn_id(), self.1)

View file

@ -15,9 +15,8 @@ fn print_crate_items(krate: &ast::Crate) -> String {
struct ToZzIdentMutVisitor;
impl MutVisitor for ToZzIdentMutVisitor {
fn token_visiting_enabled(&self) -> bool {
true
}
const VISIT_TOKENS: bool = true;
fn visit_ident(&mut self, ident: &mut Ident) {
*ident = Ident::from_str("zz");
}