diff --git a/cranelift/src/clif-util.rs b/cranelift/src/clif-util.rs index cedd823267..2396af17e4 100755 --- a/cranelift/src/clif-util.rs +++ b/cranelift/src/clif-util.rs @@ -1,9 +1,5 @@ #![deny(trivial_numeric_casts)] -#![warn( - unused_import_braces, - unstable_features, - unused_extern_crates -)] +#![warn(unused_import_braces, unstable_features, unused_extern_crates)] #![cfg_attr( feature = "cargo-clippy", warn( @@ -163,26 +159,31 @@ fn main() { .arg(add_time_flag()) .arg(add_input_file_arg()) .arg(add_debug_flag()), - ).subcommand( + ) + .subcommand( SubCommand::with_name("cat") .about("Outputs .clif file") .arg(add_input_file_arg()) .arg(add_debug_flag()), - ).subcommand( + ) + .subcommand( SubCommand::with_name("print-cfg") .about("Prints out cfg in dot format") .arg(add_input_file_arg()) .arg(add_debug_flag()), - ).subcommand( + ) + .subcommand( add_wasm_or_compile("compile") .arg( Arg::with_name("just-decode") .short("t") .help("Just decode WebAssembly to Cranelift IR"), - ).arg(Arg::with_name("check-translation").short("c").help( + ) + .arg(Arg::with_name("check-translation").short("c").help( "Just checks the correctness of Cranelift IR translated from WebAssembly", )), - ).subcommand(add_wasm_or_compile("wasm")) + ) + .subcommand(add_wasm_or_compile("wasm")) .subcommand( SubCommand::with_name("pass") .about("Run specified pass(s) on an input file.") @@ -204,7 +205,8 @@ fn main() { rest_cmd.is_present("verbose"), rest_cmd.is_present("time-passes"), &get_vec(rest_cmd.values_of("file")), - ).map(|_time| ()) + ) + .map(|_time| ()) } ("pass", Some(rest_cmd)) => { handle_debug_flag(rest_cmd.is_present("debug")); @@ -221,7 +223,8 @@ fn main() { &get_vec(rest_cmd.values_of("pass")), target_val, rest_cmd.value_of("single-file").unwrap(), - ).map(|_time| ()) + ) + .map(|_time| ()) } ("print-cfg", Some(rest_cmd)) => { handle_debug_flag(rest_cmd.is_present("debug")); diff --git a/cranelift/src/utils.rs b/cranelift/src/utils.rs index 9a6ec437bc..a05c0ac3b0 100644 --- a/cranelift/src/utils.rs +++ b/cranelift/src/utils.rs @@ -65,7 +65,8 @@ pub fn parse_sets_and_triple( flag_set.iter().map(|x| x.as_str()), &mut flag_builder, Location { line_number: 0 }, - ).map_err(|err| err.to_string())?; + ) + .map_err(|err| err.to_string())?; let mut words = flag_triple.trim().split_whitespace(); // Look for `target foo`. diff --git a/lib/bforest/src/lib.rs b/lib/bforest/src/lib.rs index 0fce1c11b6..1bc1d2a091 100644 --- a/lib/bforest/src/lib.rs +++ b/lib/bforest/src/lib.rs @@ -16,10 +16,7 @@ #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![warn(unused_import_braces)] #![cfg_attr(feature = "std", warn(unstable_features))] -#![cfg_attr( - feature = "clippy", - plugin(clippy(conf_file = "../../clippy.toml")) -)] +#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr( feature = "cargo-clippy", allow(new_without_default, new_without_default_derive) diff --git a/lib/codegen/meta/src/cdsl/isa.rs b/lib/codegen/meta/src/cdsl/isa.rs index 50e4d842c8..65edbbbb8b 100644 --- a/lib/codegen/meta/src/cdsl/isa.rs +++ b/lib/codegen/meta/src/cdsl/isa.rs @@ -153,16 +153,15 @@ impl TargetIsaBuilder { // If the intersection is the second one, then it must be a subclass. if intersect == rc2_mask { - assert!( - self.isa - .reg_classes - .get(*i1) - .unwrap() - .subclasses - .iter() - .find(|x| **x == *i2) - .is_some() - ); + assert!(self + .isa + .reg_classes + .get(*i1) + .unwrap() + .subclasses + .iter() + .find(|x| **x == *i2) + .is_some()); } } } @@ -184,7 +183,8 @@ impl TargetIsaBuilder { .values() .filter(|x| { x.toprc == x.index && self.isa.reg_banks.get(x.bank).unwrap().pressure_tracking - }).count(); + }) + .count(); assert!(num_toplevel <= 4, "Too many top-level register classes"); self.isa diff --git a/lib/codegen/meta/src/cdsl/settings.rs b/lib/codegen/meta/src/cdsl/settings.rs index f5e4c9b368..253f7680d6 100644 --- a/lib/codegen/meta/src/cdsl/settings.rs +++ b/lib/codegen/meta/src/cdsl/settings.rs @@ -128,7 +128,8 @@ impl SettingGroup { } else { false } - }).count() as u8 + }) + .count() as u8 } pub fn byte_size(&self) -> u8 { diff --git a/lib/codegen/meta/src/cdsl/types.rs b/lib/codegen/meta/src/cdsl/types.rs index 60e9888e78..9fb7754c3c 100644 --- a/lib/codegen/meta/src/cdsl/types.rs +++ b/lib/codegen/meta/src/cdsl/types.rs @@ -190,19 +190,20 @@ impl LaneType { /// Find the unique number associated with this lane type. pub fn number(self) -> u8 { - LANE_BASE + match self { - LaneType::BoolType(base_types::Bool::B1) => 0, - LaneType::BoolType(base_types::Bool::B8) => 1, - LaneType::BoolType(base_types::Bool::B16) => 2, - LaneType::BoolType(base_types::Bool::B32) => 3, - LaneType::BoolType(base_types::Bool::B64) => 4, - LaneType::IntType(base_types::Int::I8) => 5, - LaneType::IntType(base_types::Int::I16) => 6, - LaneType::IntType(base_types::Int::I32) => 7, - LaneType::IntType(base_types::Int::I64) => 8, - LaneType::FloatType(base_types::Float::F32) => 9, - LaneType::FloatType(base_types::Float::F64) => 10, - } + LANE_BASE + + match self { + LaneType::BoolType(base_types::Bool::B1) => 0, + LaneType::BoolType(base_types::Bool::B8) => 1, + LaneType::BoolType(base_types::Bool::B16) => 2, + LaneType::BoolType(base_types::Bool::B32) => 3, + LaneType::BoolType(base_types::Bool::B64) => 4, + LaneType::IntType(base_types::Int::I8) => 5, + LaneType::IntType(base_types::Int::I16) => 6, + LaneType::IntType(base_types::Int::I32) => 7, + LaneType::IntType(base_types::Int::I64) => 8, + LaneType::FloatType(base_types::Float::F32) => 9, + LaneType::FloatType(base_types::Float::F64) => 10, + } } } diff --git a/lib/codegen/meta/src/srcgen.rs b/lib/codegen/meta/src/srcgen.rs index db3eac85e8..36270b9c70 100644 --- a/lib/codegen/meta/src/srcgen.rs +++ b/lib/codegen/meta/src/srcgen.rs @@ -114,7 +114,8 @@ impl Formatter { } else { format!("/// {}", l) } - }).for_each(|s| self.line(s.as_str())); + }) + .for_each(|s| self.line(s.as_str())); } /// Add a match expression. @@ -131,7 +132,8 @@ impl Formatter { } else { name.clone() } - }).collect(); + }) + .collect(); let lhs = conditions.join(" | "); fmt.line(&format!("{} => {{", lhs)); fmt.indent(|fmt| { diff --git a/lib/codegen/src/binemit/relaxation.rs b/lib/codegen/src/binemit/relaxation.rs index 8616dccbbd..f658fb70b1 100644 --- a/lib/codegen/src/binemit/relaxation.rs +++ b/lib/codegen/src/binemit/relaxation.rs @@ -186,7 +186,8 @@ fn relax_branch( debug!(" trying [{}]: OK", encinfo.display(enc)); true } - }) { + }) + { cur.func.encodings[inst] = enc; return encinfo.byte_size(enc, inst, &divert, &cur.func); } diff --git a/lib/codegen/src/ir/dfg.rs b/lib/codegen/src/ir/dfg.rs index 2ac9969d97..905238275a 100644 --- a/lib/codegen/src/ir/dfg.rs +++ b/lib/codegen/src/ir/dfg.rs @@ -802,9 +802,9 @@ impl DataFlowGraph { .remove(num as usize, &mut self.value_lists); for index in num..(self.num_ebb_params(ebb) as u16) { match self.values[self.ebbs[ebb] - .params - .get(index as usize, &self.value_lists) - .unwrap()] + .params + .get(index as usize, &self.value_lists) + .unwrap()] { ValueData::Param { ref mut num, .. } => { *num -= 1; diff --git a/lib/codegen/src/isa/registers.rs b/lib/codegen/src/isa/registers.rs index 03376e727d..a11a3fbd52 100644 --- a/lib/codegen/src/isa/registers.rs +++ b/lib/codegen/src/isa/registers.rs @@ -89,7 +89,8 @@ impl RegBank { None } } - }.and_then(|offset| { + } + .and_then(|offset| { if offset < self.units { Some(offset + self.first_unit) } else { diff --git a/lib/codegen/src/isa/x86/abi.rs b/lib/codegen/src/isa/x86/abi.rs index 2542eb3eb9..1f385af419 100644 --- a/lib/codegen/src/isa/x86/abi.rs +++ b/lib/codegen/src/isa/x86/abi.rs @@ -98,7 +98,8 @@ impl ArgAssigner for Args { RU::r14 } else { RU::rsi - } as RegUnit).into() + } as RegUnit) + .into() } // This is SpiderMonkey's `WasmTableCallSigReg`. ArgumentPurpose::SignatureId => return ArgumentLoc::Reg(RU::r10 as RegUnit).into(), diff --git a/lib/codegen/src/legalizer/boundary.rs b/lib/codegen/src/legalizer/boundary.rs index e337704f66..8b7b6c564c 100644 --- a/lib/codegen/src/legalizer/boundary.rs +++ b/lib/codegen/src/legalizer/boundary.rs @@ -575,7 +575,8 @@ pub fn handle_return_abi(inst: Inst, func: &mut Function, cfg: &ControlFlowGraph rt.purpose == ArgumentPurpose::Link || rt.purpose == ArgumentPurpose::StructReturn || rt.purpose == ArgumentPurpose::VMContext - }).count(); + }) + .count(); let abi_args = func.signature.returns.len() - special_args; let pos = &mut FuncCursor::new(func).at_inst(inst); @@ -694,7 +695,8 @@ fn spill_call_arguments(pos: &mut FuncCursor) -> bool { } _ => None, } - }).collect::>() + }) + .collect::>() }; if arglist.is_empty() { diff --git a/lib/codegen/src/legalizer/split.rs b/lib/codegen/src/legalizer/split.rs index 46f530bf61..6de664863a 100644 --- a/lib/codegen/src/legalizer/split.rs +++ b/lib/codegen/src/legalizer/split.rs @@ -165,7 +165,8 @@ fn split_any( .get_mut( num_fixed_args + repair.hi_num, &mut pos.func.dfg.value_lists, - ).unwrap() = hi; + ) + .unwrap() = hi; } else { // We need to append one or more arguments. If we're adding more than one argument, // there must be pending repairs on the stack that will fill in the correct values diff --git a/lib/codegen/src/lib.rs b/lib/codegen/src/lib.rs index 6ece592ea7..036e096220 100644 --- a/lib/codegen/src/lib.rs +++ b/lib/codegen/src/lib.rs @@ -3,10 +3,7 @@ #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![warn(unused_import_braces)] #![cfg_attr(feature = "std", deny(unstable_features))] -#![cfg_attr( - feature = "clippy", - plugin(clippy(conf_file = "../../clippy.toml")) -)] +#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(feature="cargo-clippy", allow( // Produces only a false positive: while_let_loop, diff --git a/lib/codegen/src/print_errors.rs b/lib/codegen/src/print_errors.rs index 73c8cf809a..de9fef8844 100644 --- a/lib/codegen/src/print_errors.rs +++ b/lib/codegen/src/print_errors.rs @@ -30,14 +30,16 @@ pub fn pretty_verifier_error<'a>( &mut w, func, isa, - ).unwrap(); + ) + .unwrap(); writeln!( w, "\n; {} verifier error{} detected (see above). Compilation aborted.", num_errors, if num_errors == 1 { "" } else { "s" } - ).unwrap(); + ) + .unwrap(); w } diff --git a/lib/codegen/src/regalloc/coloring.rs b/lib/codegen/src/regalloc/coloring.rs index 5e77a42f94..8ce42737d6 100644 --- a/lib/codegen/src/regalloc/coloring.rs +++ b/lib/codegen/src/regalloc/coloring.rs @@ -914,12 +914,10 @@ impl<'a> Context<'a> { Table(jt, ebb) => { let lr = &self.liveness[value]; !lr.is_local() - && (ebb.map_or(false, |ebb| lr.is_livein(ebb, ctx)) || self - .cur - .func - .jump_tables[jt] - .iter() - .any(|ebb| lr.is_livein(*ebb, ctx))) + && (ebb.map_or(false, |ebb| lr.is_livein(ebb, ctx)) + || self.cur.func.jump_tables[jt] + .iter() + .any(|ebb| lr.is_livein(*ebb, ctx))) } } } diff --git a/lib/codegen/src/regalloc/context.rs b/lib/codegen/src/regalloc/context.rs index 08e658bd4c..c297250ea7 100644 --- a/lib/codegen/src/regalloc/context.rs +++ b/lib/codegen/src/regalloc/context.rs @@ -116,7 +116,8 @@ impl Context { &self.liveness, &self.virtregs, &mut errors, - ).is_ok(); + ) + .is_ok(); if !ok { return Err(errors.into()); @@ -144,7 +145,8 @@ impl Context { &self.liveness, &self.virtregs, &mut errors, - ).is_ok(); + ) + .is_ok(); if !ok { return Err(errors.into()); @@ -171,7 +173,8 @@ impl Context { &self.liveness, &self.virtregs, &mut errors, - ).is_ok(); + ) + .is_ok(); if !ok { return Err(errors.into()); @@ -193,7 +196,8 @@ impl Context { &self.liveness, &self.virtregs, &mut errors, - ).is_ok(); + ) + .is_ok(); if !ok { return Err(errors.into()); diff --git a/lib/codegen/src/regalloc/liveness.rs b/lib/codegen/src/regalloc/liveness.rs index 8877179e43..01f72d9adb 100644 --- a/lib/codegen/src/regalloc/liveness.rs +++ b/lib/codegen/src/regalloc/liveness.rs @@ -220,7 +220,8 @@ fn get_or_create<'a>( func.dfg .call_signature(inst) .map(|sig| Affinity::abi(&func.dfg.signatures[sig].returns[rnum], isa)) - }).unwrap_or_default(); + }) + .unwrap_or_default(); } ValueDef::Param(ebb, num) => { def = ebb.into(); diff --git a/lib/codegen/src/regalloc/register_set.rs b/lib/codegen/src/regalloc/register_set.rs index d3a11a9d45..99a3f3e416 100644 --- a/lib/codegen/src/regalloc/register_set.rs +++ b/lib/codegen/src/regalloc/register_set.rs @@ -207,7 +207,8 @@ impl<'a> fmt::Display for DisplayRegisterSet<'a> { .unwrap_or_else(|| char::from_digit( u32::from(offset % 10), 10 - ).unwrap()) + ) + .unwrap()) )?; } } diff --git a/lib/codegen/src/regalloc/reload.rs b/lib/codegen/src/regalloc/reload.rs index 6d16ec5d3f..8240d7fa51 100644 --- a/lib/codegen/src/regalloc/reload.rs +++ b/lib/codegen/src/regalloc/reload.rs @@ -264,9 +264,9 @@ impl<'a> Context<'a> { // Same thing for spilled call return values. let retvals = &defs[self.cur.func.dfg[inst] - .opcode() - .constraints() - .num_fixed_results()..]; + .opcode() + .constraints() + .num_fixed_results()..]; if !retvals.is_empty() { let sig = self .cur diff --git a/lib/codegen/src/regalloc/spilling.rs b/lib/codegen/src/regalloc/spilling.rs index 168956703c..108d08b095 100644 --- a/lib/codegen/src/regalloc/spilling.rs +++ b/lib/codegen/src/regalloc/spilling.rs @@ -504,7 +504,8 @@ impl<'a> Context<'a> { } } None - }).min_by(|&a, &b| { + }) + .min_by(|&a, &b| { // Find the minimum candidate according to the RPO of their defs. self.domtree.rpo_cmp( self.cur.func.dfg.value_def(a), diff --git a/lib/codegen/src/timing.rs b/lib/codegen/src/timing.rs index 68ca4850c0..3edca7f73f 100644 --- a/lib/codegen/src/timing.rs +++ b/lib/codegen/src/timing.rs @@ -37,7 +37,7 @@ macro_rules! define_passes { } // Pass definitions. -define_passes!{ +define_passes! { Pass, NUM_PASSES, DESCRIPTIONS; process_file: "Processing test file", @@ -176,7 +176,7 @@ mod details { } /// Information about passes in a single thread. - thread_local!{ + thread_local! { static CURRENT_PASS: Cell = Cell::new(Pass::None); static PASS_TIME: RefCell = RefCell::new(Default::default()); } diff --git a/lib/codegen/src/verifier/mod.rs b/lib/codegen/src/verifier/mod.rs index 84244cc590..adcf9d5a93 100644 --- a/lib/codegen/src/verifier/mod.rs +++ b/lib/codegen/src/verifier/mod.rs @@ -887,11 +887,11 @@ impl<'a> Verifier<'a> { ); } // The defining EBB dominates the instruction using this value. - if is_reachable && !self.expected_domtree.dominates( - ebb, - loc_inst, - &self.func.layout, - ) { + if is_reachable + && !self + .expected_domtree + .dominates(ebb, loc_inst, &self.func.layout) + { return fatal!( errors, loc_inst, @@ -1559,7 +1559,8 @@ impl<'a> Verifier<'a> { &self.func, &self.func.dfg[inst], self.func.dfg.ctrl_typevar(inst), - ).peekable(); + ) + .peekable(); if encodings.peek().is_none() { return nonfatal!( diff --git a/lib/entity/src/lib.rs b/lib/entity/src/lib.rs index d8e4fcac18..8f22caaaa7 100644 --- a/lib/entity/src/lib.rs +++ b/lib/entity/src/lib.rs @@ -32,10 +32,7 @@ #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![warn(unused_import_braces)] #![cfg_attr(feature = "std", deny(unstable_features))] -#![cfg_attr( - feature = "clippy", - plugin(clippy(conf_file = "../../clippy.toml")) -)] +#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr( feature = "cargo-clippy", allow(new_without_default, new_without_default_derive) diff --git a/lib/faerie/src/backend.rs b/lib/faerie/src/backend.rs index d51ad6e489..7028efbb01 100644 --- a/lib/faerie/src/backend.rs +++ b/lib/faerie/src/backend.rs @@ -231,7 +231,8 @@ impl Backend for FaerieBackend { from: name, to, at: u64::from(offset), - }).map_err(|e| ModuleError::Backend(e.to_string()))?; + }) + .map_err(|e| ModuleError::Backend(e.to_string()))?; } for &(offset, id, addend) in data_relocs { debug_assert_eq!( @@ -244,7 +245,8 @@ impl Backend for FaerieBackend { from: name, to, at: u64::from(offset), - }).map_err(|e| ModuleError::Backend(e.to_string()))?; + }) + .map_err(|e| ModuleError::Backend(e.to_string()))?; } self.artifact @@ -410,7 +412,8 @@ impl<'a> RelocSink for FaerieRelocSink<'a> { reloc: raw_reloc, addend: addend_i32, }, - ).expect("faerie relocation error"); + ) + .expect("faerie relocation error"); } fn reloc_jt(&mut self, _offset: CodeOffset, _reloc: Reloc, _jt: ir::JumpTable) { diff --git a/lib/faerie/src/lib.rs b/lib/faerie/src/lib.rs index 0b9187a468..51da811fae 100644 --- a/lib/faerie/src/lib.rs +++ b/lib/faerie/src/lib.rs @@ -9,10 +9,7 @@ unstable_features )] #![warn(unused_import_braces)] -#![cfg_attr( - feature = "clippy", - plugin(clippy(conf_file = "../../clippy.toml")) -)] +#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr( feature = "cargo-clippy", allow(new_without_default, new_without_default_derive) diff --git a/lib/filetests/src/concurrent.rs b/lib/filetests/src/concurrent.rs index 44963cc466..df9034618b 100644 --- a/lib/filetests/src/concurrent.rs +++ b/lib/filetests/src/concurrent.rs @@ -106,7 +106,8 @@ fn heartbeat_thread(replies: Sender) -> thread::JoinHandle<()> { while replies.send(Reply::Tick).is_ok() { thread::sleep(Duration::from_secs(1)); } - }).unwrap() + }) + .unwrap() } /// Spawn a worker thread running tests. @@ -153,5 +154,6 @@ fn worker_thread( // Timing is accumulated independently per thread. // Timings from this worker thread will be aggregated by `ConcurrentRunner::join()`. timing::take_current() - }).unwrap() + }) + .unwrap() } diff --git a/lib/filetests/src/runner.rs b/lib/filetests/src/runner.rs index b2b007803f..778150fa7c 100644 --- a/lib/filetests/src/runner.rs +++ b/lib/filetests/src/runner.rs @@ -317,7 +317,8 @@ impl TestRunner { .. } => Some(dur), _ => None, - }).collect::>(); + }) + .collect::>(); // Get me some real data, kid. let len = times.len(); diff --git a/lib/frontend/src/frontend.rs b/lib/frontend/src/frontend.rs index 692bc48de6..2e29db56c0 100644 --- a/lib/frontend/src/frontend.rs +++ b/lib/frontend/src/frontend.rs @@ -514,10 +514,12 @@ impl<'a> FunctionBuilder<'a> { None => false, Some(entry) => self.position.ebb.unwrap() == entry, }; - !is_entry && self.func_ctx.ssa.is_sealed(self.position.ebb.unwrap()) && !self - .func_ctx - .ssa - .has_any_predecessors(self.position.ebb.unwrap()) + !is_entry + && self.func_ctx.ssa.is_sealed(self.position.ebb.unwrap()) + && !self + .func_ctx + .ssa + .has_any_predecessors(self.position.ebb.unwrap()) } /// Returns `true` if and only if no instructions have been added since the last call to @@ -769,7 +771,8 @@ impl<'a> FunctionBuilder<'a> { self.ins().load(config.pointer_type(), flags, src, offset), offset, ) - }).collect(); + }) + .collect(); for (value, offset) in registers { self.ins().store(flags, value, dest, offset); diff --git a/lib/module/src/lib.rs b/lib/module/src/lib.rs index 3c569d0ec8..e9e2131b41 100644 --- a/lib/module/src/lib.rs +++ b/lib/module/src/lib.rs @@ -3,10 +3,7 @@ #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![warn(unused_import_braces)] #![cfg_attr(feature = "std", deny(unstable_features))] -#![cfg_attr( - feature = "clippy", - plugin(clippy(conf_file = "../../clippy.toml")) -)] +#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr( feature = "cargo-clippy", allow(new_without_default, new_without_default_derive) diff --git a/lib/module/src/module.rs b/lib/module/src/module.rs index d6328dab73..372fddd7ae 100644 --- a/lib/module/src/module.rs +++ b/lib/module/src/module.rs @@ -130,19 +130,14 @@ pub enum ModuleError { /// different signature than declared previously #[fail( display = "Function {} signature {:?} is incompatible with previous declaration {:?}", - _0, - _2, - _1 + _0, _2, _1 )] IncompatibleSignature(String, ir::Signature, ir::Signature), /// Indicates an identifier was defined more than once #[fail(display = "Duplicate definition of identifier: {}", _0)] DuplicateDefinition(String), /// Indicates an identifier was defined, but was declared as an import - #[fail( - display = "Invalid to define identifier declared as an import: {}", - _0 - )] + #[fail(display = "Invalid to define identifier declared as an import: {}", _0)] InvalidImportDefinition(String), /// Wraps a `cranelift-codegen` error #[fail(display = "Compilation error: {}", _0)] diff --git a/lib/native/src/lib.rs b/lib/native/src/lib.rs index 57fa5a4cd9..f8732714a0 100644 --- a/lib/native/src/lib.rs +++ b/lib/native/src/lib.rs @@ -8,10 +8,7 @@ unstable_features )] #![warn(unused_import_braces)] -#![cfg_attr( - feature = "clippy", - plugin(clippy(conf_file = "../../clippy.toml")) -)] +#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr( feature = "cargo-clippy", allow(new_without_default, new_without_default_derive) diff --git a/lib/preopt/src/lib.rs b/lib/preopt/src/lib.rs index 789b308afb..c55c70df74 100644 --- a/lib/preopt/src/lib.rs +++ b/lib/preopt/src/lib.rs @@ -1,12 +1,9 @@ //! Performes early-stage optimizations on Cranelift IR. -#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates,)] +#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![warn(unused_import_braces)] #![cfg_attr(feature = "std", deny(unstable_features))] -#![cfg_attr( - feature = "clippy", - plugin(clippy(conf_file = "../../clippy.toml")) -)] +#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr( feature = "cargo-clippy", allow(new_without_default, new_without_default_derive) diff --git a/lib/reader/src/lexer.rs b/lib/reader/src/lexer.rs index 5ac84ab773..1a77a1814e 100644 --- a/lib/reader/src/lexer.rs +++ b/lib/reader/src/lexer.rs @@ -322,7 +322,8 @@ impl<'a> Lexer<'a> { .and_then(|(prefix, number)| { Self::numbered_entity(prefix, number) .or_else(|| Self::value_type(text, prefix, number)) - }).unwrap_or_else(|| match text { + }) + .unwrap_or_else(|| match text { "iflags" => Token::Type(types::IFLAGS), "fflags" => Token::Type(types::FFLAGS), _ => Token::Identifier(text), diff --git a/lib/reader/src/lib.rs b/lib/reader/src/lib.rs index bfa9bc8207..3b8222947a 100644 --- a/lib/reader/src/lib.rs +++ b/lib/reader/src/lib.rs @@ -10,10 +10,7 @@ unstable_features )] #![warn(unused_import_braces)] -#![cfg_attr( - feature = "clippy", - plugin(clippy(conf_file = "../../clippy.toml")) -)] +#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr( feature = "cargo-clippy", allow(new_without_default, new_without_default_derive) diff --git a/lib/reader/src/parser.rs b/lib/reader/src/parser.rs index 650efe3ea0..a53f734792 100644 --- a/lib/reader/src/parser.rs +++ b/lib/reader/src/parser.rs @@ -2587,7 +2587,8 @@ mod tests { v3 -> v4 v1 = iadd_imm v3, 17 }", - ).parse_function(None) + ) + .parse_function(None) .unwrap(); assert_eq!(func.name.to_string(), "%qux"); let v4 = details.map.lookup_str("v4").unwrap(); @@ -2663,7 +2664,8 @@ mod tests { ss3 = incoming_arg 13 ss1 = spill_slot 1 }", - ).parse_function(None) + ) + .parse_function(None) .unwrap(); assert_eq!(func.name.to_string(), "%foo"); let mut iter = func.stack_slots.keys(); @@ -2686,7 +2688,8 @@ mod tests { ss1 = spill_slot 13 ss1 = spill_slot 1 }", - ).parse_function(None) + ) + .parse_function(None) .unwrap_err() .to_string(), "3: duplicate entity: ss1" @@ -2700,7 +2703,8 @@ mod tests { ebb0: ebb4(v3: i32): }", - ).parse_function(None) + ) + .parse_function(None) .unwrap(); assert_eq!(func.name.to_string(), "%ebbs"); @@ -2722,7 +2726,8 @@ mod tests { ebb0: ebb0: return 2", - ).parse_function(None) + ) + .parse_function(None) .unwrap_err(); assert_eq!(location.line_number, 3); @@ -2735,7 +2740,8 @@ mod tests { "function %ebbs() system_v { jt0 = jump_table [] jt0 = jump_table []", - ).parse_function(None) + ) + .parse_function(None) .unwrap_err(); assert_eq!(location.line_number, 3); @@ -2748,7 +2754,8 @@ mod tests { "function %ebbs() system_v { ss0 = explicit_slot 8 ss0 = explicit_slot 8", - ).parse_function(None) + ) + .parse_function(None) .unwrap_err(); assert_eq!(location.line_number, 3); @@ -2761,7 +2768,8 @@ mod tests { "function %ebbs() system_v { gv0 = vmctx gv0 = vmctx", - ).parse_function(None) + ) + .parse_function(None) .unwrap_err(); assert_eq!(location.line_number, 3); @@ -2774,7 +2782,8 @@ mod tests { "function %ebbs() system_v { heap0 = static gv0, min 0x1000, bound 0x10_0000, guard 0x1000 heap0 = static gv0, min 0x1000, bound 0x10_0000, guard 0x1000", - ).parse_function(None) + ) + .parse_function(None) .unwrap_err(); assert_eq!(location.line_number, 3); @@ -2787,7 +2796,8 @@ mod tests { "function %ebbs() system_v { sig0 = () sig0 = ()", - ).parse_function(None) + ) + .parse_function(None) .unwrap_err(); assert_eq!(location.line_number, 3); @@ -2801,7 +2811,8 @@ mod tests { sig0 = () fn0 = %foo sig0 fn0 = %foo sig0", - ).parse_function(None) + ) + .parse_function(None) .unwrap_err(); assert_eq!(location.line_number, 4); @@ -2821,7 +2832,8 @@ mod tests { trap user42; Instruction } ; Trailing. ; More trailing.", - ).parse_function(None) + ) + .parse_function(None) .unwrap(); assert_eq!(func.name.to_string(), "%comment"); assert_eq!(comments.len(), 8); // no 'before' comment. @@ -2858,7 +2870,8 @@ mod tests { function %comment() system_v {}", None, None, - ).unwrap(); + ) + .unwrap(); assert_eq!(tf.commands.len(), 2); assert_eq!(tf.commands[0].command, "cfg"); assert_eq!(tf.commands[1].command, "verify"); @@ -2879,26 +2892,25 @@ mod tests { #[test] #[cfg(build_riscv)] fn isa_spec() { - assert!( - parse_test( - "target + assert!(parse_test( + "target function %foo() system_v {}", - ).is_err() - ); + ) + .is_err()); - assert!( - parse_test( - "target riscv32 + assert!(parse_test( + "target riscv32 set enable_float=false function %foo() system_v {}", - ).is_err() - ); + ) + .is_err()); match parse_test( "set enable_float=false isa riscv function %foo() system_v {}", - ).unwrap() + ) + .unwrap() .isa_spec { IsaSpec::None(_) => panic!("Expected some ISA"), @@ -2917,7 +2929,8 @@ mod tests { ebb0: trap int_divz }", - ).parse_function(None) + ) + .parse_function(None) .unwrap() .0; assert_eq!(func.name.to_string(), "u1:2"); diff --git a/lib/reader/src/sourcemap.rs b/lib/reader/src/sourcemap.rs index 7e4da9de80..f3f0423e43 100644 --- a/lib/reader/src/sourcemap.rs +++ b/lib/reader/src/sourcemap.rs @@ -224,7 +224,8 @@ mod tests { }", None, None, - ).unwrap(); + ) + .unwrap(); let map = &tf.functions[0].1.map; assert_eq!(map.lookup_str("v0"), None); diff --git a/lib/serde/src/clif-json.rs b/lib/serde/src/clif-json.rs index bab63ace97..77498ca06e 100644 --- a/lib/serde/src/clif-json.rs +++ b/lib/serde/src/clif-json.rs @@ -7,10 +7,7 @@ unstable_features )] #![warn(unused_import_braces)] -#![cfg_attr( - feature = "clippy", - plugin(clippy(conf_file = "../../clippy.toml")) -)] +#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr( feature = "cargo-clippy", allow(new_without_default, new_without_default_derive) @@ -83,7 +80,8 @@ fn main() { .value_name("FILE") .help("Input file for serialization"), ), - ).subcommand( + ) + .subcommand( SubCommand::with_name("deserialize") .about("Deserializes Cranelift IR into JSON.") .arg( @@ -92,7 +90,8 @@ fn main() { .value_name("FILE") .help("Input file for deserialization"), ), - ).get_matches(); + ) + .get_matches(); let res_serde = match matches.subcommand() { ("serialize", Some(m)) => { diff --git a/lib/simplejit/src/lib.rs b/lib/simplejit/src/lib.rs index 50f84f67eb..f50cb826c6 100644 --- a/lib/simplejit/src/lib.rs +++ b/lib/simplejit/src/lib.rs @@ -7,10 +7,7 @@ unstable_features )] #![warn(unused_import_braces)] -#![cfg_attr( - feature = "clippy", - plugin(clippy(conf_file = "../../clippy.toml")) -)] +#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr( feature = "cargo-clippy", allow(new_without_default, new_without_default_derive) diff --git a/lib/umbrella/src/lib.rs b/lib/umbrella/src/lib.rs index 7a3a8f00dc..41a55f6fe4 100644 --- a/lib/umbrella/src/lib.rs +++ b/lib/umbrella/src/lib.rs @@ -7,10 +7,7 @@ unstable_features )] #![warn(unused_import_braces)] -#![cfg_attr( - feature = "clippy", - plugin(clippy(conf_file = "../../clippy.toml")) -)] +#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr( feature = "cargo-clippy", allow(new_without_default, new_without_default_derive) diff --git a/lib/wasm/src/environ/spec.rs b/lib/wasm/src/environ/spec.rs index d963038f19..c7910f65f1 100644 --- a/lib/wasm/src/environ/spec.rs +++ b/lib/wasm/src/environ/spec.rs @@ -35,11 +35,7 @@ pub enum WasmError { /// /// This error code is used by a WebAssembly translator when it encounters invalid WebAssembly /// code. This should never happen for validated WebAssembly code. - #[fail( - display = "Invalid input WebAssembly code at offset {}: {}", - _1, - _0 - )] + #[fail(display = "Invalid input WebAssembly code at offset {}: {}", _1, _0)] InvalidWebAssembly { /// A string describing the validation error. message: &'static str, diff --git a/lib/wasm/src/lib.rs b/lib/wasm/src/lib.rs index 86f7c2a769..e528d5f966 100644 --- a/lib/wasm/src/lib.rs +++ b/lib/wasm/src/lib.rs @@ -12,10 +12,7 @@ #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![warn(unused_import_braces)] #![cfg_attr(feature = "std", deny(unstable_features))] -#![cfg_attr( - feature = "clippy", - plugin(clippy(conf_file = "../../clippy.toml")) -)] +#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr( feature = "cargo-clippy", allow(new_without_default, new_without_default_derive) diff --git a/lib/wasm/tests/wasm_testsuite.rs b/lib/wasm/tests/wasm_testsuite.rs index bf0dee04dc..18b8c08c11 100644 --- a/lib/wasm/tests/wasm_testsuite.rs +++ b/lib/wasm/tests/wasm_testsuite.rs @@ -30,7 +30,8 @@ fn testsuite() { } } false - }).collect(); + }) + .collect(); paths.sort_by_key(|dir| dir.path()); let flags = Flags::new(settings::builder()); for path in paths {