Avoid unnecessary '&' in matches.
https://github.com/rust-lang-nursery/rust-clippy/wiki#match_ref_pats
This commit is contained in:
@@ -10,8 +10,8 @@ use ir::{self, InstBuilder};
|
|||||||
/// Expand a `global_addr` instruction according to the definition of the global variable.
|
/// Expand a `global_addr` instruction according to the definition of the global variable.
|
||||||
pub fn expand_global_addr(inst: ir::Inst, func: &mut ir::Function, _cfg: &mut ControlFlowGraph) {
|
pub fn expand_global_addr(inst: ir::Inst, func: &mut ir::Function, _cfg: &mut ControlFlowGraph) {
|
||||||
// Unpack the instruction.
|
// Unpack the instruction.
|
||||||
let gv = match &func.dfg[inst] {
|
let gv = match func.dfg[inst] {
|
||||||
&ir::InstructionData::UnaryGlobalVar { opcode, global_var } => {
|
ir::InstructionData::UnaryGlobalVar { opcode, global_var } => {
|
||||||
assert_eq!(opcode, ir::Opcode::GlobalAddr);
|
assert_eq!(opcode, ir::Opcode::GlobalAddr);
|
||||||
global_var
|
global_var
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ use ir::condcodes::IntCC;
|
|||||||
/// Expand a `heap_addr` instruction according to the definition of the heap.
|
/// Expand a `heap_addr` instruction according to the definition of the heap.
|
||||||
pub fn expand_heap_addr(inst: ir::Inst, func: &mut ir::Function, _cfg: &mut ControlFlowGraph) {
|
pub fn expand_heap_addr(inst: ir::Inst, func: &mut ir::Function, _cfg: &mut ControlFlowGraph) {
|
||||||
// Unpack the instruction.
|
// Unpack the instruction.
|
||||||
let (heap, offset, size) = match &func.dfg[inst] {
|
let (heap, offset, size) = match func.dfg[inst] {
|
||||||
&ir::InstructionData::HeapAddr {
|
ir::InstructionData::HeapAddr {
|
||||||
opcode,
|
opcode,
|
||||||
heap,
|
heap,
|
||||||
arg,
|
arg,
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ impl<'a> Verifier<'a> {
|
|||||||
seen.insert(gv);
|
seen.insert(gv);
|
||||||
|
|
||||||
let mut cur = gv;
|
let mut cur = gv;
|
||||||
while let &ir::GlobalVarData::Deref { base, .. } = &self.func.global_vars[cur] {
|
while let ir::GlobalVarData::Deref { base, .. } = self.func.global_vars[cur] {
|
||||||
if seen.insert(base).is_some() {
|
if seen.insert(base).is_some() {
|
||||||
return err!(gv, "deref cycle: {}", DisplayList(seen.as_slice()));
|
return err!(gv, "deref cycle: {}", DisplayList(seen.as_slice()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -420,8 +420,8 @@ fn translate_operator(
|
|||||||
// and push a new control frame with a new ebb for the code after the if/then/else
|
// and push a new control frame with a new ebb for the code after the if/then/else
|
||||||
// At the end of the then clause we jump to the destination
|
// At the end of the then clause we jump to the destination
|
||||||
let i = control_stack.len() - 1;
|
let i = control_stack.len() - 1;
|
||||||
let (destination, return_values, branch_inst) = match &control_stack[i] {
|
let (destination, return_values, branch_inst) = match control_stack[i] {
|
||||||
&ControlStackFrame::If {
|
ControlStackFrame::If {
|
||||||
destination,
|
destination,
|
||||||
ref return_values,
|
ref return_values,
|
||||||
branch_inst,
|
branch_inst,
|
||||||
@@ -1276,9 +1276,9 @@ fn translate_unreachable_operator(
|
|||||||
} else {
|
} else {
|
||||||
// Encountering an real else means that the code in the else
|
// Encountering an real else means that the code in the else
|
||||||
// clause is reachable again
|
// clause is reachable again
|
||||||
let (branch_inst, original_stack_size) =
|
let (branch_inst, original_stack_size) = match control_stack[control_stack.len() -
|
||||||
match &control_stack[control_stack.len() - 1] {
|
1] {
|
||||||
&ControlStackFrame::If {
|
ControlStackFrame::If {
|
||||||
branch_inst,
|
branch_inst,
|
||||||
original_stack_size,
|
original_stack_size,
|
||||||
..
|
..
|
||||||
|
|||||||
Reference in New Issue
Block a user