Implemented clippy improvements

This commit is contained in:
Aaron Power
2018-07-24 14:17:21 +01:00
committed by Dan Gohman
parent d6d1e7253d
commit eed861c6e1
5 changed files with 15 additions and 14 deletions

View File

@@ -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,
}

View File

@@ -61,7 +61,7 @@ fn pretty_function_error(
)
}
}
_ => write!(w, "{}", "\n"),
_ => writeln!(w),
}
}

View File

@@ -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.

View File

@@ -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)

View File

@@ -157,7 +157,7 @@ impl Backend for FaerieBackend {
artifact: &mut self.artifact,
name,
namespace,
libcall_names: &self.libcall_names,
libcall_names: &*self.libcall_names,
};
if let Some(ref mut trap_manifest) = self.trap_manifest {
@@ -347,7 +347,7 @@ struct FaerieRelocSink<'a> {
artifact: &'a mut faerie::Artifact,
name: &'a str,
namespace: &'a ModuleNamespace<'a, FaerieBackend>,
libcall_names: &'a Box<Fn(ir::LibCall) -> String>,
libcall_names: &'a Fn(ir::LibCall) -> String,
}
impl<'a> RelocSink for FaerieRelocSink<'a> {