diff --git a/lib/cretonne/meta/gen_encoding.py b/lib/cretonne/meta/gen_encoding.py index 706ad46780..bbe1df7591 100644 --- a/lib/cretonne/meta/gen_encoding.py +++ b/lib/cretonne/meta/gen_encoding.py @@ -451,7 +451,7 @@ def emit_recipe_names(isa, fmt): This is used for pretty-printing encodings. """ with fmt.indented( - 'static RECIPE_NAMES: [&\'static str; {}] = [' + 'static RECIPE_NAMES: [&str; {}] = [' .format(len(isa.all_recipes)), '];'): for r in isa.all_recipes: fmt.line('"{}",'.format(r.name)) diff --git a/lib/cretonne/meta/gen_instr.py b/lib/cretonne/meta/gen_instr.py index b1b32b7bf3..f3a4343ab2 100644 --- a/lib/cretonne/meta/gen_instr.py +++ b/lib/cretonne/meta/gen_instr.py @@ -470,7 +470,7 @@ def gen_format_constructor(iform, fmt): # Generate the instruction data. with fmt.indented( 'let data = InstructionData::{} {{'.format(iform.name), '};'): - fmt.line('opcode: opcode,') + fmt.line('opcode,') gen_member_inits(iform, fmt) fmt.line('self.build(data, ctrl_typevar)') @@ -489,7 +489,7 @@ def gen_member_inits(iform, fmt): # Value operands. if iform.has_value_list: - fmt.line('args: args,') + fmt.line('args,') elif iform.num_value_operands == 1: fmt.line('arg: arg0,') elif iform.num_value_operands > 1: diff --git a/lib/cretonne/meta/gen_settings.py b/lib/cretonne/meta/gen_settings.py index 847a72399d..23e9a5c7a9 100644 --- a/lib/cretonne/meta/gen_settings.py +++ b/lib/cretonne/meta/gen_settings.py @@ -132,7 +132,7 @@ def gen_descriptors(sgrp, fmt): raise AssertionError("Unknown setting kind") with fmt.indented( - 'static ENUMERATORS: [&\'static str; {}] = [' + 'static ENUMERATORS: [&str; {}] = [' .format(len(enums.table)), '];'): for txt in enums.table: diff --git a/lib/cretonne/src/ir/builder.rs b/lib/cretonne/src/ir/builder.rs index d9ef0faa25..ae71f754c7 100644 --- a/lib/cretonne/src/ir/builder.rs +++ b/lib/cretonne/src/ir/builder.rs @@ -56,7 +56,7 @@ impl<'c, 'fc, 'fd> InsertBuilder<'c, 'fc, 'fd> { pub fn new(dfg: &'fd mut DataFlowGraph, pos: &'c mut Cursor<'fc>) -> InsertBuilder<'c, 'fc, 'fd> { - InsertBuilder { dfg: dfg, pos: pos } + InsertBuilder { dfg, pos } } /// Reuse result values in `reuse`. @@ -72,7 +72,7 @@ impl<'c, 'fc, 'fd> InsertBuilder<'c, 'fc, 'fd> { InsertReuseBuilder { dfg: self.dfg, pos: self.pos, - reuse: reuse, + reuse, } } @@ -154,10 +154,7 @@ pub struct ReplaceBuilder<'f> { impl<'f> ReplaceBuilder<'f> { /// Create a `ReplaceBuilder` that will overwrite `inst`. pub fn new(dfg: &'f mut DataFlowGraph, inst: Inst) -> ReplaceBuilder { - ReplaceBuilder { - dfg: dfg, - inst: inst, - } + ReplaceBuilder { dfg, inst } } } diff --git a/lib/cretonne/src/ir/dfg.rs b/lib/cretonne/src/ir/dfg.rs index 9f1a8b5299..063d7cbbd7 100644 --- a/lib/cretonne/src/ir/dfg.rs +++ b/lib/cretonne/src/ir/dfg.rs @@ -240,10 +240,7 @@ impl DataFlowGraph { self.value_type(dest), ty); - self.values[dest] = ValueData::Alias { - ty: ty, - original: original, - }; + self.values[dest] = ValueData::Alias { ty, original }; } /// Create a new value alias. @@ -252,10 +249,7 @@ impl DataFlowGraph { pub fn make_value_alias(&mut self, src: Value) -> Value { let ty = self.value_type(src); - let data = ValueData::Alias { - ty: ty, - original: src, - }; + let data = ValueData::Alias { ty, original: src }; self.make_value(data) } } @@ -462,9 +456,9 @@ impl DataFlowGraph { assert!(num <= u16::MAX as usize, "Too many result values"); let ty = self.value_type(res); self.values[res] = ValueData::Inst { - ty: ty, + ty, num: num as u16, - inst: inst, + inst, }; } @@ -474,8 +468,8 @@ impl DataFlowGraph { let num = self.results[inst].push(res, &mut self.value_lists); assert!(num <= u16::MAX as usize, "Too many result values"); self.make_value(ValueData::Inst { - ty: ty, - inst: inst, + ty, + inst, num: num as u16, }) } @@ -594,9 +588,9 @@ impl DataFlowGraph { let num = self.ebbs[ebb].args.push(arg, &mut self.value_lists); assert!(num <= u16::MAX as usize, "Too many arguments to EBB"); self.make_value(ValueData::Arg { - ty: ty, + ty, num: num as u16, - ebb: ebb, + ebb, }) } @@ -611,9 +605,9 @@ impl DataFlowGraph { assert!(num <= u16::MAX as usize, "Too many arguments to EBB"); let ty = self.value_type(arg); self.values[arg] = ValueData::Arg { - ty: ty, + ty, num: num as u16, - ebb: ebb, + ebb, }; } @@ -635,8 +629,8 @@ impl DataFlowGraph { }; let new_arg = self.make_value(ValueData::Arg { ty: new_type, - num: num, - ebb: ebb, + num, + ebb, }); self.ebbs[ebb].args.as_mut_slice(&mut self.value_lists)[num as usize] = new_arg; diff --git a/lib/cretonne/src/ir/extfunc.rs b/lib/cretonne/src/ir/extfunc.rs index 0971015f62..e0863f8d1d 100644 --- a/lib/cretonne/src/ir/extfunc.rs +++ b/lib/cretonne/src/ir/extfunc.rs @@ -138,7 +138,7 @@ impl ArgumentType { ArgumentType { value_type: vt, extension: ArgumentExtension::None, - purpose: purpose, + purpose, location: ArgumentLoc::Reg(regunit), } } @@ -239,7 +239,7 @@ pub enum ArgumentPurpose { } /// Text format names of the `ArgumentPurpose` variants. -static PURPOSE_NAMES: [&'static str; 5] = ["normal", "sret", "link", "fp", "csr"]; +static PURPOSE_NAMES: [&str; 5] = ["normal", "sret", "link", "fp", "csr"]; impl fmt::Display for ArgumentPurpose { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/lib/cretonne/src/ir/function.rs b/lib/cretonne/src/ir/function.rs index 177ca0b5f1..075ee7c6fd 100644 --- a/lib/cretonne/src/ir/function.rs +++ b/lib/cretonne/src/ir/function.rs @@ -57,7 +57,7 @@ impl Function { /// Create a function with the given name and signature. pub fn with_name_signature(name: FunctionName, sig: Signature) -> Function { Function { - name: name, + name, signature: sig, stack_slots: EntityMap::new(), jump_tables: EntityMap::new(), diff --git a/lib/cretonne/src/ir/layout.rs b/lib/cretonne/src/ir/layout.rs index 6e3e793125..b8ef83e75b 100644 --- a/lib/cretonne/src/ir/layout.rs +++ b/lib/cretonne/src/ir/layout.rs @@ -647,7 +647,7 @@ impl<'f> Cursor<'f> { /// The cursor holds a mutable reference to `layout` for its entire lifetime. pub fn new(layout: &'f mut Layout) -> Cursor { Cursor { - layout: layout, + layout, pos: CursorPosition::Nowhere, } } diff --git a/lib/cretonne/src/ir/memflags.rs b/lib/cretonne/src/ir/memflags.rs index 8cef887da2..bd2f2bab19 100644 --- a/lib/cretonne/src/ir/memflags.rs +++ b/lib/cretonne/src/ir/memflags.rs @@ -7,7 +7,7 @@ enum FlagBit { Aligned, } -const NAMES: [&'static str; 2] = ["notrap", "aligned"]; +const NAMES: [&str; 2] = ["notrap", "aligned"]; /// Flags for memory operations like load/store. /// diff --git a/lib/cretonne/src/isa/arm32/mod.rs b/lib/cretonne/src/isa/arm32/mod.rs index ec9de51917..e3128fdc0e 100644 --- a/lib/cretonne/src/isa/arm32/mod.rs +++ b/lib/cretonne/src/isa/arm32/mod.rs @@ -39,7 +39,7 @@ fn isa_constructor(shared_flags: shared_settings::Flags, }; Box::new(Isa { isa_flags: settings::Flags::new(&shared_flags, builder), - shared_flags: shared_flags, + shared_flags, cpumode: level1, }) } diff --git a/lib/cretonne/src/isa/arm64/mod.rs b/lib/cretonne/src/isa/arm64/mod.rs index 4067142f57..f6fd70fb7a 100644 --- a/lib/cretonne/src/isa/arm64/mod.rs +++ b/lib/cretonne/src/isa/arm64/mod.rs @@ -33,7 +33,7 @@ fn isa_constructor(shared_flags: shared_settings::Flags, -> Box { Box::new(Isa { isa_flags: settings::Flags::new(&shared_flags, builder), - shared_flags: shared_flags, + shared_flags, }) } diff --git a/lib/cretonne/src/isa/encoding.rs b/lib/cretonne/src/isa/encoding.rs index 3d866727a4..93888b109e 100644 --- a/lib/cretonne/src/isa/encoding.rs +++ b/lib/cretonne/src/isa/encoding.rs @@ -19,10 +19,7 @@ pub struct Encoding { impl Encoding { /// Create a new `Encoding` containing `(recipe, bits)`. pub fn new(recipe: u16, bits: u16) -> Encoding { - Encoding { - recipe: recipe, - bits: bits, - } + Encoding { recipe, bits } } /// Get the recipe number in this encoding. diff --git a/lib/cretonne/src/isa/intel/mod.rs b/lib/cretonne/src/isa/intel/mod.rs index 1812a41354..5871c8766a 100644 --- a/lib/cretonne/src/isa/intel/mod.rs +++ b/lib/cretonne/src/isa/intel/mod.rs @@ -39,7 +39,7 @@ fn isa_constructor(shared_flags: shared_settings::Flags, }; Box::new(Isa { isa_flags: settings::Flags::new(&shared_flags, builder), - shared_flags: shared_flags, + shared_flags, cpumode: level1, }) } diff --git a/lib/cretonne/src/isa/registers.rs b/lib/cretonne/src/isa/registers.rs index 3c4f1b411a..15a089db17 100644 --- a/lib/cretonne/src/isa/registers.rs +++ b/lib/cretonne/src/isa/registers.rs @@ -220,7 +220,7 @@ impl RegInfo { /// Make a temporary object that can display a register unit. pub fn display_regunit(&self, regunit: RegUnit) -> DisplayRegUnit { DisplayRegUnit { - regunit: regunit, + regunit, reginfo: self, } } diff --git a/lib/cretonne/src/isa/riscv/mod.rs b/lib/cretonne/src/isa/riscv/mod.rs index cf5aafc7db..ad64e4fd29 100644 --- a/lib/cretonne/src/isa/riscv/mod.rs +++ b/lib/cretonne/src/isa/riscv/mod.rs @@ -39,7 +39,7 @@ fn isa_constructor(shared_flags: shared_settings::Flags, }; Box::new(Isa { isa_flags: settings::Flags::new(&shared_flags, builder), - shared_flags: shared_flags, + shared_flags, cpumode: level1, }) } diff --git a/lib/cretonne/src/iterators.rs b/lib/cretonne/src/iterators.rs index 3bdc3cc1cb..bca8cea2e4 100644 --- a/lib/cretonne/src/iterators.rs +++ b/lib/cretonne/src/iterators.rs @@ -8,10 +8,7 @@ pub trait IteratorExtras: Iterator { Self::Item: Clone { let elem = self.next(); - AdjacentPairs { - iter: self, - elem: elem, - } + AdjacentPairs { iter: self, elem } } } diff --git a/lib/cretonne/src/legalizer/split.rs b/lib/cretonne/src/legalizer/split.rs index 764448b5bc..cbca25c9c2 100644 --- a/lib/cretonne/src/legalizer/split.rs +++ b/lib/cretonne/src/legalizer/split.rs @@ -261,11 +261,11 @@ fn add_repair(concat: Opcode, hi_num: usize, repairs: &mut Vec) { repairs.push(Repair { - concat: concat, - split_type: split_type, - ebb: ebb, - num: num, - hi_num: hi_num, + concat, + split_type, + ebb, + num, + hi_num, }); } diff --git a/lib/cretonne/src/regalloc/coloring.rs b/lib/cretonne/src/regalloc/coloring.rs index 0a5e9e803a..544c5b5da0 100644 --- a/lib/cretonne/src/regalloc/coloring.rs +++ b/lib/cretonne/src/regalloc/coloring.rs @@ -99,8 +99,8 @@ impl Coloring { let mut ctx = Context { reginfo: isa.register_info(), encinfo: isa.encoding_info(), - domtree: domtree, - liveness: liveness, + domtree, + liveness, usable_regs: isa.allocatable_registers(func), }; ctx.run(self, func, tracker) diff --git a/lib/cretonne/src/regalloc/live_value_tracker.rs b/lib/cretonne/src/regalloc/live_value_tracker.rs index c9f5146245..78085564f7 100644 --- a/lib/cretonne/src/regalloc/live_value_tracker.rs +++ b/lib/cretonne/src/regalloc/live_value_tracker.rs @@ -70,9 +70,9 @@ impl LiveValueVec { fn push(&mut self, value: Value, endpoint: Inst, affinity: Affinity) { self.values .push(LiveValue { - value: value, - endpoint: endpoint, - affinity: affinity, + value, + endpoint, + affinity, }); } diff --git a/lib/cretonne/src/regalloc/liverange.rs b/lib/cretonne/src/regalloc/liverange.rs index 0594af19ed..a854cfc9ea 100644 --- a/lib/cretonne/src/regalloc/liverange.rs +++ b/lib/cretonne/src/regalloc/liverange.rs @@ -208,8 +208,8 @@ impl LiveRange { /// The live range will be created as dead, but it can be extended with `extend_in_ebb()`. pub fn new(value: Value, def: ProgramPoint, affinity: Affinity) -> LiveRange { LiveRange { - value: value, - affinity: affinity, + value, + affinity, def_begin: def, def_end: def, liveins: Vec::new(), diff --git a/lib/cretonne/src/verifier/liveness.rs b/lib/cretonne/src/verifier/liveness.rs index d3d841b68e..51911b3f38 100644 --- a/lib/cretonne/src/verifier/liveness.rs +++ b/lib/cretonne/src/verifier/liveness.rs @@ -27,10 +27,10 @@ pub fn verify_liveness(isa: &TargetIsa, liveness: &Liveness) -> Result { let verifier = LivenessVerifier { - isa: isa, - func: func, - cfg: cfg, - liveness: liveness, + isa, + func, + cfg, + liveness, }; verifier.check_ebbs()?; verifier.check_insts()?; diff --git a/lib/cretonne/src/verifier/mod.rs b/lib/cretonne/src/verifier/mod.rs index e3d5607c99..82e95d7f1f 100644 --- a/lib/cretonne/src/verifier/mod.rs +++ b/lib/cretonne/src/verifier/mod.rs @@ -139,10 +139,10 @@ impl<'a> Verifier<'a> { let cfg = ControlFlowGraph::with_function(func); let domtree = DominatorTree::with_function(func, &cfg); Verifier { - func: func, - cfg: cfg, - domtree: domtree, - isa: isa, + func, + cfg, + domtree, + isa, } } diff --git a/lib/filecheck/src/checker.rs b/lib/filecheck/src/checker.rs index 031a50d9e3..e70768e32c 100644 --- a/lib/filecheck/src/checker.rs +++ b/lib/filecheck/src/checker.rs @@ -25,7 +25,7 @@ enum Directive { // 1. Keyword. // 2. Rest of line / pattern. // -const DIRECTIVE_RX: &'static str = r"\b(check|sameln|nextln|unordered|not|regex):\s+(.*)"; +const DIRECTIVE_RX: &str = r"\b(check|sameln|nextln|unordered|not|regex):\s+(.*)"; impl Directive { /// Create a new directive from a `DIRECTIVE_RX` match. @@ -264,9 +264,9 @@ struct State<'a> { impl<'a> State<'a> { fn new(text: &'a str, env_vars: &'a VariableMap, recorder: &'a mut Recorder) -> State<'a> { State { - text: text, - env_vars: env_vars, - recorder: recorder, + text, + env_vars, + recorder, vars: HashMap::new(), last_ordered: 0, max_match: 0, diff --git a/lib/filecheck/src/explain.rs b/lib/filecheck/src/explain.rs index 49780321b5..f268620d11 100644 --- a/lib/filecheck/src/explain.rs +++ b/lib/filecheck/src/explain.rs @@ -60,7 +60,7 @@ pub struct Explainer<'a> { impl<'a> Explainer<'a> { pub fn new(text: &'a str) -> Explainer { Explainer { - text: text, + text, directive: 0, matches: Vec::new(), vardefs: Vec::new(), diff --git a/lib/reader/src/lexer.rs b/lib/reader/src/lexer.rs index 14a0fe45a4..1262b63888 100644 --- a/lib/reader/src/lexer.rs +++ b/lib/reader/src/lexer.rs @@ -55,7 +55,7 @@ pub struct LocatedToken<'a> { /// Wrap up a `Token` with the given location. fn token<'a>(token: Token<'a>, loc: Location) -> Result, LocatedError> { Ok(LocatedToken { - token: token, + token, location: loc, }) } @@ -76,7 +76,7 @@ pub struct LocatedError { /// Wrap up an `Error` with the given location. fn error<'a>(error: Error, loc: Location) -> Result, LocatedError> { Err(LocatedError { - error: error, + error, location: loc, }) } diff --git a/lib/reader/src/parser.rs b/lib/reader/src/parser.rs index eae8c925b0..02ec88196e 100644 --- a/lib/reader/src/parser.rs +++ b/lib/reader/src/parser.rs @@ -51,10 +51,10 @@ pub fn parse_test<'a>(text: &'a str) -> Result> { let functions = parser.parse_function_list(isa_spec.unique_isa())?; Ok(TestFile { - commands: commands, - isa_spec: isa_spec, - preamble_comments: preamble_comments, - functions: functions, + commands, + isa_spec, + preamble_comments, + functions, }) } @@ -100,7 +100,7 @@ impl<'a> Context<'a> { function: f, map: SourceMap::new(), aliases: HashMap::new(), - unique_isa: unique_isa, + unique_isa, } } @@ -272,11 +272,7 @@ impl<'a> Parser<'a> { Token::Comment(text) => { // Gather comments, associate them with `comment_entity`. if let Some(entity) = self.comment_entity { - self.comments - .push(Comment { - entity: entity, - text: text, - }); + self.comments.push(Comment { entity, text }); } } _ => self.lookahead = Some(token), @@ -676,7 +672,7 @@ impl<'a> Parser<'a> { ctx.rewrite_references()?; let details = Details { - location: location, + location, comments: self.take_comments(), map: ctx.map, }; @@ -924,7 +920,7 @@ impl<'a> Parser<'a> { .def_entity(sigref.into(), &loc) .expect("duplicate SigRef entities created"); ExtFuncData { - name: name, + name, signature: sigref, } } @@ -933,7 +929,7 @@ impl<'a> Parser<'a> { self.consume(); let name = self.parse_function_name()?; ExtFuncData { - name: name, + name, signature: sig, } } @@ -1416,28 +1412,28 @@ impl<'a> Parser<'a> { opcode: Opcode) -> Result { let idata = match opcode.format() { - InstructionFormat::Nullary => InstructionData::Nullary { opcode: opcode }, + InstructionFormat::Nullary => InstructionData::Nullary { opcode }, InstructionFormat::Unary => { InstructionData::Unary { - opcode: opcode, + opcode, arg: self.match_value("expected SSA value operand")?, } } InstructionFormat::UnaryImm => { InstructionData::UnaryImm { - opcode: opcode, + opcode, imm: self.match_imm64("expected immediate integer operand")?, } } InstructionFormat::UnaryIeee32 => { InstructionData::UnaryIeee32 { - opcode: opcode, + opcode, imm: self.match_ieee32("expected immediate 32-bit float operand")?, } } InstructionFormat::UnaryIeee64 => { InstructionData::UnaryIeee64 { - opcode: opcode, + opcode, imm: self.match_ieee64("expected immediate 64-bit float operand")?, } } @@ -1446,7 +1442,7 @@ impl<'a> Parser<'a> { self.match_token(Token::Comma, "expected ',' between operands")?; let rhs = self.match_value("expected SSA value second operand")?; InstructionData::Binary { - opcode: opcode, + opcode, args: [lhs, rhs], } } @@ -1455,7 +1451,7 @@ impl<'a> Parser<'a> { self.match_token(Token::Comma, "expected ',' between operands")?; let rhs = self.match_imm64("expected immediate integer second operand")?; InstructionData::BinaryImm { - opcode: opcode, + opcode, arg: lhs, imm: rhs, } @@ -1469,14 +1465,14 @@ impl<'a> Parser<'a> { self.match_token(Token::Comma, "expected ',' between operands")?; let false_arg = self.match_value("expected SSA value false operand")?; InstructionData::Ternary { - opcode: opcode, + opcode, args: [ctrl_arg, true_arg, false_arg], } } InstructionFormat::MultiAry => { let args = self.parse_value_list()?; InstructionData::MultiAry { - opcode: opcode, + opcode, args: args.into_value_list(&[], &mut ctx.function.dfg.value_lists), } } @@ -1485,7 +1481,7 @@ impl<'a> Parser<'a> { let ebb_num = self.match_ebb("expected jump destination EBB")?; let args = self.parse_opt_value_list()?; InstructionData::Jump { - opcode: opcode, + opcode, destination: ebb_num, args: args.into_value_list(&[], &mut ctx.function.dfg.value_lists), } @@ -1496,7 +1492,7 @@ impl<'a> Parser<'a> { let ebb_num = self.match_ebb("expected branch destination EBB")?; let args = self.parse_opt_value_list()?; InstructionData::Branch { - opcode: opcode, + opcode, destination: ebb_num, args: args.into_value_list(&[ctrl_arg], &mut ctx.function.dfg.value_lists), } @@ -1510,8 +1506,8 @@ impl<'a> Parser<'a> { let ebb_num = self.match_ebb("expected branch destination EBB")?; let args = self.parse_opt_value_list()?; InstructionData::BranchIcmp { - opcode: opcode, - cond: cond, + opcode, + cond, destination: ebb_num, args: args.into_value_list(&[lhs, rhs], &mut ctx.function.dfg.value_lists), } @@ -1523,8 +1519,8 @@ impl<'a> Parser<'a> { self.match_token(Token::Comma, "expected ',' between operands")?; let rhs = self.match_value("expected SSA value last operand")?; InstructionData::InsertLane { - opcode: opcode, - lane: lane, + opcode, + lane, args: [lhs, rhs], } } @@ -1532,11 +1528,7 @@ impl<'a> Parser<'a> { let arg = self.match_value("expected SSA value last operand")?; self.match_token(Token::Comma, "expected ',' between operands")?; let lane = self.match_uimm8("expected lane number")?; - InstructionData::ExtractLane { - opcode: opcode, - lane: lane, - arg: arg, - } + InstructionData::ExtractLane { opcode, lane, arg } } InstructionFormat::IntCompare => { let cond = self.match_enum("expected intcc condition code")?; @@ -1544,8 +1536,8 @@ impl<'a> Parser<'a> { self.match_token(Token::Comma, "expected ',' between operands")?; let rhs = self.match_value("expected SSA value second operand")?; InstructionData::IntCompare { - opcode: opcode, - cond: cond, + opcode, + cond, args: [lhs, rhs], } } @@ -1555,8 +1547,8 @@ impl<'a> Parser<'a> { self.match_token(Token::Comma, "expected ',' between operands")?; let rhs = self.match_imm64("expected immediate second operand")?; InstructionData::IntCompareImm { - opcode: opcode, - cond: cond, + opcode, + cond, arg: lhs, imm: rhs, } @@ -1567,8 +1559,8 @@ impl<'a> Parser<'a> { self.match_token(Token::Comma, "expected ',' between operands")?; let rhs = self.match_value("expected SSA value second operand")?; InstructionData::FloatCompare { - opcode: opcode, - cond: cond, + opcode, + cond, args: [lhs, rhs], } } @@ -1579,8 +1571,8 @@ impl<'a> Parser<'a> { let args = self.parse_value_list()?; self.match_token(Token::RPar, "expected ')' after arguments")?; InstructionData::Call { - opcode: opcode, - func_ref: func_ref, + opcode, + func_ref, args: args.into_value_list(&[], &mut ctx.function.dfg.value_lists), } } @@ -1593,8 +1585,8 @@ impl<'a> Parser<'a> { let args = self.parse_value_list()?; self.match_token(Token::RPar, "expected ')' after arguments")?; InstructionData::IndirectCall { - opcode: opcode, - sig_ref: sig_ref, + opcode, + sig_ref, args: args.into_value_list(&[callee], &mut ctx.function.dfg.value_lists), } } @@ -1603,20 +1595,16 @@ impl<'a> Parser<'a> { self.match_token(Token::Comma, "expected ',' between operands")?; let table = self.match_jt() .and_then(|num| ctx.get_jt(num, &self.loc))?; - InstructionData::BranchTable { - opcode: opcode, - arg: arg, - table: table, - } + InstructionData::BranchTable { opcode, arg, table } } InstructionFormat::StackLoad => { let ss = self.match_ss("expected stack slot number: ss«n»") .and_then(|num| ctx.get_ss(num, &self.loc))?; let offset = self.optional_offset32()?; InstructionData::StackLoad { - opcode: opcode, + opcode, stack_slot: ss, - offset: offset, + offset, } } InstructionFormat::StackStore => { @@ -1626,19 +1614,19 @@ impl<'a> Parser<'a> { .and_then(|num| ctx.get_ss(num, &self.loc))?; let offset = self.optional_offset32()?; InstructionData::StackStore { - opcode: opcode, - arg: arg, + opcode, + arg, stack_slot: ss, - offset: offset, + offset, } } InstructionFormat::HeapLoad => { let addr = self.match_value("expected SSA value address")?; let offset = self.optional_uoffset32()?; InstructionData::HeapLoad { - opcode: opcode, + opcode, arg: addr, - offset: offset, + offset, } } InstructionFormat::HeapStore => { @@ -1647,9 +1635,9 @@ impl<'a> Parser<'a> { let addr = self.match_value("expected SSA value address")?; let offset = self.optional_uoffset32()?; InstructionData::HeapStore { - opcode: opcode, + opcode, args: [arg, addr], - offset: offset, + offset, } } InstructionFormat::Load => { @@ -1657,10 +1645,10 @@ impl<'a> Parser<'a> { let addr = self.match_value("expected SSA value address")?; let offset = self.optional_offset32()?; InstructionData::Load { - opcode: opcode, - flags: flags, + opcode, + flags, arg: addr, - offset: offset, + offset, } } InstructionFormat::Store => { @@ -1670,10 +1658,10 @@ impl<'a> Parser<'a> { let addr = self.match_value("expected SSA value address")?; let offset = self.optional_offset32()?; InstructionData::Store { - opcode: opcode, - flags: flags, + opcode, + flags, args: [arg, addr], - offset: offset, + offset, } } }; diff --git a/src/cton-util.rs b/src/cton-util.rs index fea4d879be..70fcbc3c84 100644 --- a/src/cton-util.rs +++ b/src/cton-util.rs @@ -17,7 +17,7 @@ mod cat; mod print_cfg; mod rsfilecheck; -const USAGE: &'static str = " +const USAGE: &str = " Cretonne code generator utility Usage: diff --git a/src/filetest/concurrent.rs b/src/filetest/concurrent.rs index 9ea1114000..dbdd76f35c 100644 --- a/src/filetest/concurrent.rs +++ b/src/filetest/concurrent.rs @@ -51,8 +51,8 @@ impl ConcurrentRunner { ConcurrentRunner { request_tx: Some(request_tx), - reply_rx: reply_rx, - handles: handles, + reply_rx, + handles, } } @@ -120,10 +120,7 @@ fn worker_thread(thread_num: usize, // Tell them we're starting this job. // The receiver should always be present for this as long as we have jobs. replies - .send(Reply::Starting { - jobid: jobid, - thread_num: thread_num, - }) + .send(Reply::Starting { jobid, thread_num }) .unwrap(); let result = catch_unwind(|| runone::run(path.as_path())).unwrap_or_else(|e| { @@ -142,12 +139,7 @@ fn worker_thread(thread_num: usize, dbg!("FAIL: {}", msg); } - replies - .send(Reply::Done { - jobid: jobid, - result: result, - }) - .unwrap(); + replies.send(Reply::Done { jobid, result }).unwrap(); } }) .unwrap() diff --git a/src/filetest/runner.rs b/src/filetest/runner.rs index 1993ca5877..23f94fe78f 100644 --- a/src/filetest/runner.rs +++ b/src/filetest/runner.rs @@ -81,7 +81,7 @@ impl TestRunner { /// Create a new blank TrstRunner. pub fn new(verbose: bool) -> TestRunner { TestRunner { - verbose: verbose, + verbose, dir_stack: Vec::new(), tests: Vec::new(), new_tests: 0, diff --git a/src/filetest/runone.rs b/src/filetest/runone.rs index 60231d22f4..621f2bfd6a 100644 --- a/src/filetest/runone.rs +++ b/src/filetest/runone.rs @@ -55,9 +55,9 @@ pub fn run(path: &Path) -> TestResult { for (func, details) in testfile.functions { let mut context = Context { preamble_comments: &testfile.preamble_comments, - details: details, + details, verified: false, - flags: flags, + flags, isa: None, }; diff --git a/src/print_cfg.rs b/src/print_cfg.rs index d5b87d806b..1d5deff68c 100644 --- a/src/print_cfg.rs +++ b/src/print_cfg.rs @@ -32,7 +32,7 @@ struct CFGPrinter<'a> { impl<'a> CFGPrinter<'a> { pub fn new(func: &'a Function) -> CFGPrinter<'a> { CFGPrinter { - func: func, + func, cfg: ControlFlowGraph::with_function(func), } }