diff options
| author | bors <bors@rust-lang.org> | 2023-04-16 13:12:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-04-16 13:12:53 +0000 |
| commit | 8a778ca1e35e4a8df95c00d800100d95e63e7722 (patch) | |
| tree | f74a5282fe636aa9e51d238b2cb46a9092a5c38b /compiler/rustc_mir_build/src | |
| parent | 1b50ea9abb65b33aac7285dbe36b37f9e33381a2 (diff) | |
| parent | 38215fb77aca2dcd25277ff7b3093ea56e4e8ffb (diff) | |
| download | rust-8a778ca1e35e4a8df95c00d800100d95e63e7722.tar.gz rust-8a778ca1e35e4a8df95c00d800100d95e63e7722.zip | |
Auto merge of #110405 - fee1-dead-contrib:rollup-9rkree6, r=fee1-dead
Rollup of 4 pull requests
Successful merges:
- #110397 (Move some utils out of `rustc_const_eval`)
- #110398 (use matches! macro in more places)
- #110400 (more clippy fixes: clippy::{iter_cloned_collect, unwarp_or_else_defau…)
- #110402 (Remove the loop in `Align::from_bytes`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_mir_build/src')
| -rw-r--r-- | compiler/rustc_mir_build/src/errors.rs | 9 | ||||
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/check_match.rs | 6 |
2 files changed, 4 insertions, 11 deletions
diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index 43e787db41a..dcdeaf008d6 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -384,13 +384,8 @@ impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> { diag.span_note(span, fluent::mir_build_def_note); } - let is_variant_list_non_exhaustive = match self.ty.kind() { - ty::Adt(def, _) if def.is_variant_list_non_exhaustive() && !def.did().is_local() => { - true - } - _ => false, - }; - + let is_variant_list_non_exhaustive = matches!(self.ty.kind(), + ty::Adt(def, _) if def.is_variant_list_non_exhaustive() && !def.did().is_local()); if is_variant_list_non_exhaustive { diag.note(fluent::mir_build_non_exhaustive_type_note); } else { diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index bac46db2b1e..0ef48c42f87 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -671,10 +671,8 @@ fn non_exhaustive_match<'p, 'tcx>( }; }; - let is_variant_list_non_exhaustive = match scrut_ty.kind() { - ty::Adt(def, _) if def.is_variant_list_non_exhaustive() && !def.did().is_local() => true, - _ => false, - }; + let is_variant_list_non_exhaustive = matches!(scrut_ty.kind(), + ty::Adt(def, _) if def.is_variant_list_non_exhaustive() && !def.did().is_local()); adt_defined_here(cx, &mut err, scrut_ty, &witnesses); err.note(&format!( |
