Enable and fix several more clippy lints.

This commit is contained in:
Dan Gohman
2018-04-02 08:48:06 -07:00
parent 5c6cb202d8
commit bf597b7abf
71 changed files with 360 additions and 219 deletions

View File

@@ -102,8 +102,7 @@ impl<'a> FlagsVerifier<'a> {
if self.encinfo
.as_ref()
.and_then(|ei| ei.operand_constraints(self.func.encodings[inst]))
.map(|c| c.clobbers_flags)
.unwrap_or(false) && live_val.is_some()
.map_or(false, |c| c.clobbers_flags) && live_val.is_some()
{
return err!(inst, "encoding clobbers live CPU flags in {}", live);
}

View File

@@ -78,7 +78,7 @@ impl<'a> LivenessVerifier<'a> {
if encoding.is_legal() {
// A legal instruction is not allowed to define ghost values.
if lr.affinity.is_none() {
if lr.affinity.is_unassigned() {
return err!(
inst,
"{} is a ghost value defined by a real [{}] instruction",
@@ -86,7 +86,7 @@ impl<'a> LivenessVerifier<'a> {
self.isa.encoding_info().display(encoding)
);
}
} else if !lr.affinity.is_none() {
} else if !lr.affinity.is_unassigned() {
// A non-encoded instruction can only define ghost values.
return err!(
inst,
@@ -108,7 +108,7 @@ impl<'a> LivenessVerifier<'a> {
}
// A legal instruction is not allowed to depend on ghost values.
if encoding.is_legal() && lr.affinity.is_none() {
if encoding.is_legal() && lr.affinity.is_unassigned() {
return err!(
inst,
"{} is a ghost value used by a real [{}] instruction",

View File

@@ -244,9 +244,9 @@ impl<'a> Verifier<'a> {
let fixed_results = inst_data.opcode().constraints().fixed_results();
// var_results is 0 if we aren't a call instruction
let var_results = dfg.call_signature(inst)
.map(|sig| dfg.signatures[sig].returns.len())
.unwrap_or(0);
let var_results = dfg.call_signature(inst).map_or(0, |sig| {
dfg.signatures[sig].returns.len()
});
let total_results = fixed_results + var_results;
// All result values for multi-valued instructions are created