Fix remaining clippy warnings (#1340)
* clippy: allow complex encoding function * clippy: remove unnecessary main() function in doctest * clippy: remove redundant `Type` suffix on LaneType enum variants * clippy: ignore incorrect debug_assert_with_mut_call warning * clippy: fix FDE clippy warnings
This commit is contained in:
committed by
Yury Delendik
parent
435fc71d68
commit
e1d513ab4b
@@ -10,7 +10,6 @@ use gimli::write::{
|
||||
FrameDescriptionEntry, FrameTable, Result, Writer,
|
||||
};
|
||||
use gimli::{Encoding, Format, LittleEndian, Register, X86_64};
|
||||
use std::ptr;
|
||||
|
||||
pub type FDERelocEntry = (FrameUnwindOffset, Reloc);
|
||||
|
||||
@@ -196,7 +195,7 @@ pub fn emit_fde(func: &Function, isa: &dyn TargetIsa, sink: &mut dyn FrameUnwind
|
||||
assert!(last_offset <= address_offset);
|
||||
if let Some(cmds) = frame_layout.instructions.get(&inst) {
|
||||
for cmd in cmds.iter() {
|
||||
changes.push((address_offset, cmd.clone()));
|
||||
changes.push((address_offset, *cmd));
|
||||
}
|
||||
}
|
||||
last_offset = address_offset;
|
||||
@@ -252,7 +251,9 @@ pub fn emit_fde(func: &Function, isa: &dyn TargetIsa, sink: &mut dyn FrameUnwind
|
||||
for (off, r) in relocs {
|
||||
sink.reloc(r, off + unwind_start);
|
||||
}
|
||||
let fde_offset = unsafe { ptr::read::<u32>(bytes.as_ptr() as *const u32) } as usize + 4;
|
||||
|
||||
let cie_len = u32::from_le_bytes(bytes.as_slice()[..4].try_into().unwrap());
|
||||
let fde_offset = cie_len as usize + 4;
|
||||
sink.set_entry_offset(unwind_start + fde_offset);
|
||||
|
||||
// Need 0 marker for GCC unwind to end FDE "list".
|
||||
|
||||
@@ -124,8 +124,13 @@ pub fn do_simple_gvn(func: &mut Function, domtree: &mut DominatorTree) {
|
||||
use crate::scoped_hash_map::Entry::*;
|
||||
match visible_values.entry(key) {
|
||||
Occupied(entry) => {
|
||||
let layout = &func.layout;
|
||||
debug_assert!(domtree.dominates(*entry.get(), inst, layout));
|
||||
#[allow(clippy::debug_assert_with_mut_call)]
|
||||
{
|
||||
// Clippy incorrectly believes `&func.layout` should not be used here:
|
||||
// https://github.com/rust-lang/rust-clippy/issues/4737
|
||||
debug_assert!(domtree.dominates(*entry.get(), inst, &func.layout));
|
||||
}
|
||||
|
||||
// If the redundant instruction is representing the current
|
||||
// scope, pick a new representative.
|
||||
let old = scope_stack.last_mut().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user