Skip to content

Commit

Permalink
Auto merge of rust-lang#79806 - LeSeulArtichaut:fixup-filter-is-none,…
Browse files Browse the repository at this point in the history
… r=jyn514

Fixup: `filter().is_none()` -> `!any()`
  • Loading branch information
bors committed Dec 8, 2020
2 parents 5e48ea9 + 9cc563b commit 4fd4a98
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions compiler/rustc_typeck/src/check/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}

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
Expand All @@ -1185,12 +1185,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
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));
Expand Down

0 comments on commit 4fd4a98

Please sign in to comment.