[2016][rust][23.1] clippy

sorbet
Alpha Chen 8 years ago
parent 5586d6eff1
commit c493689f5d

@ -31,9 +31,9 @@ impl Assembunny {
let replacement = match instruction { let replacement = match instruction {
Instruction::Cpy(a, b) => Instruction::Jnz(a, b), Instruction::Cpy(a, b) => Instruction::Jnz(a, b),
Instruction::Inc(x) => Instruction::Dec(x), Instruction::Inc(x) => Instruction::Dec(x),
Instruction::Dec(x) => Instruction::Inc(x), Instruction::Dec(x) |
Instruction::Jnz(a, b) => Instruction::Cpy(a, b),
Instruction::Tgl(x) => Instruction::Inc(x), Instruction::Tgl(x) => Instruction::Inc(x),
Instruction::Jnz(a, b) => Instruction::Cpy(a, b),
}; };
self.instructions[i] = replacement; self.instructions[i] = replacement;
} }
@ -169,12 +169,12 @@ pub enum Instruction {
impl fmt::Display for Instruction { impl fmt::Display for Instruction {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self { match *self {
&Instruction::Cpy(a, b) => write!(f, "cpy {} {}", a, b), Instruction::Cpy(a, b) => write!(f, "cpy {} {}", a, b),
&Instruction::Inc(a) => write!(f, "inc {}", a), Instruction::Inc(a) => write!(f, "inc {}", a),
&Instruction::Dec(a) => write!(f, "dec {}", a), Instruction::Dec(a) => write!(f, "dec {}", a),
&Instruction::Jnz(a, b) => write!(f, "jnz {} {}", a, b), Instruction::Jnz(a, b) => write!(f, "jnz {} {}", a, b),
&Instruction::Tgl(a) => write!(f, "tgl {}", a), Instruction::Tgl(a) => write!(f, "tgl {}", a),
} }
} }
} }
@ -187,11 +187,11 @@ pub enum Variable {
impl fmt::Display for Variable { impl fmt::Display for Variable {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self { match *self {
&Variable::Register(r) => { Variable::Register(r) => {
write!(f, "{}", format!("{:?}", r).to_lowercase()) write!(f, "{}", format!("{:?}", r).to_lowercase())
} }
&Variable::Value(v) => write!(f, "{:?}", v), Variable::Value(v) => write!(f, "{:?}", v),
} }
} }
} }

Loading…
Cancel
Save