Skip to content

Commit 0010fc8

Browse files
committed
use exhaustive pattern match to prevent future bugs
1 parent 3d5a1e3 commit 0010fc8

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

compiler/rustc_mir/src/transform/instcombine.rs

+13-4
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,18 @@ struct OptimizationList<'tcx> {
301301

302302
impl<'tcx> OptimizationList<'tcx> {
303303
fn is_empty(&self) -> bool {
304-
self.and_stars.is_empty()
305-
&& self.arrays_lengths.is_empty()
306-
&& self.unneeded_equality_comparison.is_empty()
307-
&& self.unneeded_deref.is_empty()
304+
match self {
305+
OptimizationList {
306+
and_stars,
307+
arrays_lengths,
308+
unneeded_equality_comparison,
309+
unneeded_deref,
310+
} => {
311+
and_stars.is_empty()
312+
&& arrays_lengths.is_empty()
313+
&& unneeded_equality_comparison.is_empty()
314+
&& unneeded_deref.is_empty()
315+
}
316+
}
308317
}
309318
}

0 commit comments

Comments
 (0)