resolve clippy errors
Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
parent
a61bf3093e
commit
81d7d7aabd
10 changed files with 24 additions and 26 deletions
|
@ -114,20 +114,16 @@ impl<'hir> Iterator for ParentOwnerIterator<'hir> {
|
|||
if self.current_id == CRATE_HIR_ID {
|
||||
return None;
|
||||
}
|
||||
loop {
|
||||
// There are nodes that do not have entries, so we need to skip them.
|
||||
let parent_id = self.map.def_key(self.current_id.owner.def_id).parent;
|
||||
|
||||
let parent_id = parent_id.map_or(CRATE_OWNER_ID, |local_def_index| {
|
||||
let def_id = LocalDefId { local_def_index };
|
||||
self.map.tcx.local_def_id_to_hir_id(def_id).owner
|
||||
});
|
||||
self.current_id = HirId::make_owner(parent_id.def_id);
|
||||
let parent_id = self.map.def_key(self.current_id.owner.def_id).parent;
|
||||
let parent_id = parent_id.map_or(CRATE_OWNER_ID, |local_def_index| {
|
||||
let def_id = LocalDefId { local_def_index };
|
||||
self.map.tcx.local_def_id_to_hir_id(def_id).owner
|
||||
});
|
||||
self.current_id = HirId::make_owner(parent_id.def_id);
|
||||
|
||||
// If this `HirId` doesn't have an entry, skip it and look for its `parent_id`.
|
||||
let node = self.map.tcx.hir_owner_node(self.current_id.owner);
|
||||
return Some((self.current_id.owner, node));
|
||||
}
|
||||
let node = self.map.tcx.hir_owner_node(self.current_id.owner);
|
||||
return Some((self.current_id.owner, node));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -671,11 +671,11 @@ pub fn read_target_uint(endianness: Endian, mut source: &[u8]) -> Result<u128, i
|
|||
// So we do not read exactly 16 bytes into the u128, just the "payload".
|
||||
let uint = match endianness {
|
||||
Endian::Little => {
|
||||
source.read(&mut buf)?;
|
||||
source.read_exact(&mut buf[..source.len()])?;
|
||||
Ok(u128::from_le_bytes(buf))
|
||||
}
|
||||
Endian::Big => {
|
||||
source.read(&mut buf[16 - source.len()..])?;
|
||||
source.read_exact(&mut buf[16 - source.len()..])?;
|
||||
Ok(u128::from_be_bytes(buf))
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue