Rollup merge of #99528 - matthiaskrgr:2022_07_perf, r=estebank

couple of clippy::perf fixes
This commit is contained in:
Matthias Krüger
2022-07-21 18:42:07 +02:00
committed by GitHub
10 changed files with 17 additions and 21 deletions

View File

@@ -88,19 +88,17 @@ impl<'tcx> ValTree<'tcx> {
let leafs = self
.unwrap_branch()
.into_iter()
.map(|v| v.unwrap_leaf().try_to_u8().unwrap())
.collect::<Vec<_>>();
.map(|v| v.unwrap_leaf().try_to_u8().unwrap());
return Some(tcx.arena.alloc_from_iter(leafs.into_iter()));
return Some(tcx.arena.alloc_from_iter(leafs));
}
ty::Slice(slice_ty) if *slice_ty == tcx.types.u8 => {
let leafs = self
.unwrap_branch()
.into_iter()
.map(|v| v.unwrap_leaf().try_to_u8().unwrap())
.collect::<Vec<_>>();
.map(|v| v.unwrap_leaf().try_to_u8().unwrap());
return Some(tcx.arena.alloc_from_iter(leafs.into_iter()));
return Some(tcx.arena.alloc_from_iter(leafs));
}
_ => {}
},