]> git.lizzy.rs Git - rust.git/commitdiff
Fixup: `filter().is_none()` -> `!any()`
authorLeSeulArtichaut <leseulartichaut@gmail.com>
Mon, 7 Dec 2020 20:40:20 +0000 (21:40 +0100)
committerLeSeulArtichaut <leseulartichaut@gmail.com>
Mon, 7 Dec 2020 20:40:20 +0000 (21:40 +0100)
compiler/rustc_typeck/src/check/pat.rs

index bcb73e1b4e74e9a4bf11fdd185d2fe7df759b623..5fc573a57ad0bac366b511e2242e4f22aec0080a 100644 (file)
@@ -1174,7 +1174,7 @@ fn check_struct_pat_fields(
         }
 
         let mut unmentioned_err = None;
-        // Report an error if incorrect number of the fields were specified.
+        // Report an error if an incorrect number of fields was specified.
         if adt.is_union() {
             if fields.len() != 1 {
                 tcx.sess
@@ -1185,12 +1185,9 @@ fn check_struct_pat_fields(
                 tcx.sess.struct_span_err(pat.span, "`..` cannot be used in union patterns").emit();
             }
         } else if !etc && !unmentioned_fields.is_empty() {
-            let no_accessible_unmentioned_fields = unmentioned_fields
-                .iter()
-                .find(|(field, _)| {
-                    field.vis.is_accessible_from(tcx.parent_module(pat.hir_id).to_def_id(), tcx)
-                })
-                .is_none();
+            let no_accessible_unmentioned_fields = !unmentioned_fields.iter().any(|(field, _)| {
+                field.vis.is_accessible_from(tcx.parent_module(pat.hir_id).to_def_id(), tcx)
+            });
 
             if no_accessible_unmentioned_fields {
                 unmentioned_err = Some(self.error_no_accessible_fields(pat, &fields));