Skip to content

Commit

Permalink
use exhaustive pattern match to prevent future bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
simonvandel committed Dec 28, 2020
1 parent 3d5a1e3 commit 0010fc8
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions compiler/rustc_mir/src/transform/instcombine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,18 @@ struct OptimizationList<'tcx> {

impl<'tcx> OptimizationList<'tcx> {
fn is_empty(&self) -> bool {
self.and_stars.is_empty()
&& self.arrays_lengths.is_empty()
&& self.unneeded_equality_comparison.is_empty()
&& self.unneeded_deref.is_empty()
match self {
OptimizationList {
and_stars,
arrays_lengths,
unneeded_equality_comparison,
unneeded_deref,
} => {
and_stars.is_empty()
&& arrays_lengths.is_empty()
&& unneeded_equality_comparison.is_empty()
&& unneeded_deref.is_empty()
}
}
}
}

0 comments on commit 0010fc8

Please sign in to comment.