Skip to content

Commit

Permalink
Merge an assert + cast into a try_into call
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Nov 12, 2018
1 parent 0195812 commit 6fc8779
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/librustc_mir/build/matches/util.rs
Expand Up @@ -35,8 +35,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
opt_slice: Option<&'pat Pattern<'tcx>>,
suffix: &'pat [Pattern<'tcx>]) {
let min_length = prefix.len() + suffix.len();
assert!(min_length < u32::MAX as usize);
let min_length = min_length as u32;
let min_length = min_length.try_into().unwrap();

match_pairs.extend(
prefix.iter()
Expand Down

0 comments on commit 6fc8779

Please sign in to comment.