Rollup merge of #67115 - Centril:simplify-check-decl-no-pat, r=davidtwco
Simplify `check_decl_no_pat`. r? @davidtwco
This commit is contained in:
commit
a0e00f824a
1 changed files with 5 additions and 5 deletions
|
@ -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),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue