1
Fork 0

minor code cleanups

This commit is contained in:
Matthias Krüger 2022-12-12 19:49:53 +01:00
parent 37d7de3379
commit 2ea368e53c
8 changed files with 11 additions and 20 deletions

View file

@ -802,12 +802,9 @@ impl Integer {
pub fn for_align<C: HasDataLayout>(cx: &C, wanted: Align) -> Option<Integer> {
let dl = cx.data_layout();
for candidate in [I8, I16, I32, I64, I128] {
if wanted == candidate.align(dl).abi && wanted.bytes() == candidate.size().bytes() {
return Some(candidate);
}
}
None
[I8, I16, I32, I64, I128].into_iter().find(|&candidate| {
wanted == candidate.align(dl).abi && wanted.bytes() == candidate.size().bytes()
})
}
/// Find the largest integer with the given alignment or less.