Skip to content

Commit 4fd4a98

Browse files
committed
Auto merge of #79806 - LeSeulArtichaut:fixup-filter-is-none, r=jyn514
Fixup: `filter().is_none()` -> `!any()`
2 parents 5e48ea9 + 9cc563b commit 4fd4a98

File tree

1 file changed

+4
-7
lines changed
  • compiler/rustc_typeck/src/check

1 file changed

+4
-7
lines changed

compiler/rustc_typeck/src/check/pat.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11741174
}
11751175

11761176
let mut unmentioned_err = None;
1177-
// Report an error if incorrect number of the fields were specified.
1177+
// Report an error if an incorrect number of fields was specified.
11781178
if adt.is_union() {
11791179
if fields.len() != 1 {
11801180
tcx.sess
@@ -1185,12 +1185,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11851185
tcx.sess.struct_span_err(pat.span, "`..` cannot be used in union patterns").emit();
11861186
}
11871187
} else if !etc && !unmentioned_fields.is_empty() {
1188-
let no_accessible_unmentioned_fields = unmentioned_fields
1189-
.iter()
1190-
.find(|(field, _)| {
1191-
field.vis.is_accessible_from(tcx.parent_module(pat.hir_id).to_def_id(), tcx)
1192-
})
1193-
.is_none();
1188+
let no_accessible_unmentioned_fields = !unmentioned_fields.iter().any(|(field, _)| {
1189+
field.vis.is_accessible_from(tcx.parent_module(pat.hir_id).to_def_id(), tcx)
1190+
});
11941191

11951192
if no_accessible_unmentioned_fields {
11961193
unmentioned_err = Some(self.error_no_accessible_fields(pat, &fields));

0 commit comments

Comments
 (0)