Remove ref patterns from rustc_ast

Also use if let chains in one case.
This commit is contained in:
Maybe Waffle
2022-11-16 19:26:38 +00:00
parent 736c675d2a
commit 417ed9fee2
6 changed files with 214 additions and 224 deletions

View File

@@ -601,9 +601,10 @@ impl Token {
/// Returns `true` if the token is an interpolated path.
fn is_path(&self) -> bool {
if let Interpolated(ref nt) = self.kind && let NtPath(..) = **nt {
if let Interpolated(nt) = &self.kind && let NtPath(..) = **nt {
return true;
}
false
}
@@ -611,7 +612,7 @@ impl Token {
/// That is, is this a pre-parsed expression dropped into the token stream
/// (which happens while parsing the result of macro expansion)?
pub fn is_whole_expr(&self) -> bool {
if let Interpolated(ref nt) = self.kind
if let Interpolated(nt) = &self.kind
&& let NtExpr(_) | NtLiteral(_) | NtPath(_) | NtBlock(_) = **nt
{
return true;
@@ -622,9 +623,10 @@ impl Token {
// Is the token an interpolated block (`$b:block`)?
pub fn is_whole_block(&self) -> bool {
if let Interpolated(ref nt) = self.kind && let NtBlock(..) = **nt {
if let Interpolated(nt) = &self.kind && let NtBlock(..) = **nt {
return true;
}
false
}