Implemented clippy improvements
This commit is contained in:
@@ -218,7 +218,7 @@ fn optimize_complex_addresses(pos: &mut EncCursor, inst: Inst, isa: &TargetIsa)
|
||||
if let ValueDef::Result(result_inst, _) = pos.func.dfg.value_def(info.arg) {
|
||||
match pos.func.dfg[result_inst] {
|
||||
InstructionData::Binary { opcode, args } if opcode == Opcode::Iadd => {
|
||||
info.add_args = Some(args.clone());
|
||||
info.add_args = Some(args);
|
||||
}
|
||||
_ => return,
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ fn pretty_function_error(
|
||||
)
|
||||
}
|
||||
}
|
||||
_ => write!(w, "{}", "\n"),
|
||||
_ => writeln!(w),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1012,7 +1012,7 @@ impl VirtualCopies {
|
||||
/// Returns `None` if none of the currently active parameters are defined at `ebb`. Otherwise
|
||||
/// returns `(set_id, argnum)` for an active parameter defined at `ebb`.
|
||||
fn lookup(&self, ebb: Ebb) -> Option<(u8, usize)> {
|
||||
self.filter.get(&ebb).map(|t| *t)
|
||||
self.filter.get(&ebb).cloned()
|
||||
}
|
||||
|
||||
/// Get an iterator of dom-forest nodes corresponding to the current filter.
|
||||
|
||||
@@ -204,16 +204,16 @@ impl Pressure {
|
||||
///
|
||||
/// This does not check if there are enough registers available.
|
||||
pub fn take(&mut self, rc: RegClass) {
|
||||
self.toprc
|
||||
.get_mut(rc.toprc as usize)
|
||||
.map(|t| t.base_count += 1);
|
||||
if let Some(t) = self.toprc.get_mut(rc.toprc as usize) {
|
||||
t.base_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
/// Free a register in `rc`.
|
||||
pub fn free(&mut self, rc: RegClass) {
|
||||
self.toprc
|
||||
.get_mut(rc.toprc as usize)
|
||||
.map(|t| t.base_count -= 1);
|
||||
if let Some(t) = self.toprc.get_mut(rc.toprc as usize) {
|
||||
t.base_count -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/// Reset all counts to 0, both base and transient.
|
||||
@@ -230,9 +230,10 @@ impl Pressure {
|
||||
pub fn take_transient(&mut self, rc: RegClass) -> Result<(), RegClassMask> {
|
||||
let mask = self.check_avail(rc);
|
||||
if mask == 0 {
|
||||
self.toprc
|
||||
.get_mut(rc.toprc as usize)
|
||||
.map(|t| t.transient_count += 1);
|
||||
if let Some(t) = self.toprc.get_mut(rc.toprc as usize) {
|
||||
t.transient_count += 1;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
} else {
|
||||
Err(mask)
|
||||
|
||||
Reference in New Issue
Block a user