]> git.lizzy.rs Git - rust.git/commitdiff
Simplify `check_decl_no_pat`.
authorMazdak Farrokhzad <twingoow@gmail.com>
Sun, 1 Dec 2019 11:43:39 +0000 (12:43 +0100)
committerMazdak Farrokhzad <twingoow@gmail.com>
Sat, 7 Dec 2019 05:13:08 +0000 (06:13 +0100)
src/librustc_passes/ast_validation.rs

index 29cfee8408f30d209f21333bd24010b116e61090..202b6ae2f94c470a8903fd2ceba820a2fe053d9a 100644 (file)
@@ -158,14 +158,14 @@ fn invalid_visibility(&self, vis: &Visibility, note: Option<&str>) {
         err.emit();
     }
 
-    fn check_decl_no_pat<F: FnMut(Span, bool)>(decl: &FnDecl, mut report_err: F) {
-        for arg in &decl.inputs {
-            match arg.pat.kind {
+    fn check_decl_no_pat(decl: &FnDecl, mut report_err: impl FnMut(Span, bool)) {
+        for Param { pat, .. } in &decl.inputs {
+            match pat.kind {
                 PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), _, None) |
                 PatKind::Wild => {}
                 PatKind::Ident(BindingMode::ByValue(Mutability::Mutable), _, None) =>
-                    report_err(arg.pat.span, true),
-                _ => report_err(arg.pat.span, false),
+                    report_err(pat.span, true),
+                _ => report_err(pat.span, false),
             }
         }
     }