1
Fork 0

Rollup merge of #67115 - Centril:simplify-check-decl-no-pat, r=davidtwco

Simplify `check_decl_no_pat`.

r? @davidtwco
This commit is contained in:
Tyler Mandry 2019-12-09 14:33:05 -08:00 committed by GitHub
commit a0e00f824a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -158,14 +158,14 @@ impl<'a> AstValidator<'a> {
err.emit(); err.emit();
} }
fn check_decl_no_pat<F: FnMut(Span, bool)>(decl: &FnDecl, mut report_err: F) { fn check_decl_no_pat(decl: &FnDecl, mut report_err: impl FnMut(Span, bool)) {
for arg in &decl.inputs { for Param { pat, .. } in &decl.inputs {
match arg.pat.kind { match pat.kind {
PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), _, None) | PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), _, None) |
PatKind::Wild => {} PatKind::Wild => {}
PatKind::Ident(BindingMode::ByValue(Mutability::Mutable), _, None) => PatKind::Ident(BindingMode::ByValue(Mutability::Mutable), _, None) =>
report_err(arg.pat.span, true), report_err(pat.span, true),
_ => report_err(arg.pat.span, false), _ => report_err(pat.span, false),
} }
} }
} }