Rollup merge of #94445 - c410-f3r:more-let-chains, r=cjgillot

4 - Make more use of `let_chains`

Continuation of #94376.

cc #53667
This commit is contained in:
Matthias Krüger 2022-02-28 20:05:17 +01:00 committed by GitHub
commit 5be38d2bb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 72 additions and 76 deletions

View file

@ -48,15 +48,13 @@ impl<'a> Parser<'a> {
// Don't use `maybe_whole` so that we have precise control
// over when we bump the parser
if let token::Interpolated(nt) = &self.token.kind {
if let token::NtStmt(stmt) = &**nt {
let mut stmt = stmt.clone();
self.bump();
stmt.visit_attrs(|stmt_attrs| {
attrs.prepend_to_nt_inner(stmt_attrs);
});
return Ok(Some(stmt));
}
if let token::Interpolated(nt) = &self.token.kind && let token::NtStmt(stmt) = &**nt {
let mut stmt = stmt.clone();
self.bump();
stmt.visit_attrs(|stmt_attrs| {
attrs.prepend_to_nt_inner(stmt_attrs);
});
return Ok(Some(stmt));
}
Ok(Some(if self.token.is_keyword(kw::Let) {