Merge an assert + cast into a try_into call

This commit is contained in:
Oliver Scherer 2018-10-31 11:06:38 +01:00
parent 0195812aea
commit 6fc8779b1e

View File

@ -35,8 +35,7 @@ pub fn prefix_slice_suffix<'pat>(&mut self,
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()