Browse Source

Update to the rustfmt in rust 1.29, which is now stable.

pull/1019/head
Dan Gohman 6 years ago
parent
commit
53a0c6c67f
  1. 30
      cranelift/src/clif-util.rs
  2. 20
      lib/bforest/src/lib.rs
  3. 3
      lib/codegen/src/isa/x86/abi.rs
  4. 6
      lib/codegen/src/legalizer/boundary.rs
  5. 15
      lib/codegen/src/lib.rs
  6. 3
      lib/codegen/src/regalloc/coloring.rs
  7. 3
      lib/codegen/src/regalloc/liveness.rs
  8. 3
      lib/codegen/src/regalloc/spilling.rs
  9. 3
      lib/codegen/src/verifier/flags.rs
  10. 17
      lib/codegen/src/verifier/mod.rs
  11. 20
      lib/entity/src/lib.rs
  12. 9
      lib/faerie/src/backend.rs
  13. 27
      lib/faerie/src/lib.rs
  14. 6
      lib/filetests/src/concurrent.rs
  15. 13
      lib/filetests/src/lib.rs
  16. 3
      lib/filetests/src/runner.rs
  17. 3
      lib/frontend/src/frontend.rs
  18. 10
      lib/frontend/src/lib.rs
  19. 20
      lib/module/src/lib.rs
  20. 5
      lib/module/src/module.rs
  21. 27
      lib/native/src/lib.rs
  22. 3
      lib/reader/src/lexer.rs
  23. 27
      lib/reader/src/lib.rs
  24. 7
      lib/reader/src/parser.rs
  25. 32
      lib/serde/src/clif-json.rs
  26. 27
      lib/simplejit/src/lib.rs
  27. 27
      lib/umbrella/src/lib.rs
  28. 6
      lib/wasm/src/environ/spec.rs
  29. 20
      lib/wasm/src/lib.rs
  30. 3
      lib/wasm/tests/wasm_testsuite.rs

30
cranelift/src/clif-util.rs

@ -1,10 +1,19 @@
#![deny(trivial_numeric_casts)] #![deny(trivial_numeric_casts)]
#![warn(unused_import_braces, unstable_features, unused_extern_crates)] #![warn(
unused_import_braces,
unstable_features,
unused_extern_crates
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
warn( warn(
float_arithmetic, mut_mut, nonminimal_bool, option_map_unwrap_or, option_map_unwrap_or_else, float_arithmetic,
unicode_not_nfc, use_self mut_mut,
nonminimal_bool,
option_map_unwrap_or,
option_map_unwrap_or_else,
unicode_not_nfc,
use_self
) )
)] )]
@ -153,31 +162,26 @@ fn main() {
.arg(add_time_flag()) .arg(add_time_flag())
.arg(add_input_file_arg()) .arg(add_input_file_arg())
.arg(add_debug_flag()), .arg(add_debug_flag()),
) ).subcommand(
.subcommand(
SubCommand::with_name("cat") SubCommand::with_name("cat")
.about("Outputs .clif file") .about("Outputs .clif file")
.arg(add_input_file_arg()) .arg(add_input_file_arg())
.arg(add_debug_flag()), .arg(add_debug_flag()),
) ).subcommand(
.subcommand(
SubCommand::with_name("print-cfg") SubCommand::with_name("print-cfg")
.about("Prints out cfg in dot format") .about("Prints out cfg in dot format")
.arg(add_input_file_arg()) .arg(add_input_file_arg())
.arg(add_debug_flag()), .arg(add_debug_flag()),
) ).subcommand(
.subcommand(
add_wasm_or_compile("compile") add_wasm_or_compile("compile")
.arg( .arg(
Arg::with_name("just-decode") Arg::with_name("just-decode")
.short("t") .short("t")
.help("Just decode WebAssembly to Cranelift IR"), .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", "Just checks the correctness of Cranelift IR translated from WebAssembly",
)), )),
) ).subcommand(add_wasm_or_compile("wasm"))
.subcommand(add_wasm_or_compile("wasm"))
.subcommand( .subcommand(
SubCommand::with_name("pass") SubCommand::with_name("pass")
.about("Run specified pass(s) on an input file.") .about("Run specified pass(s) on an input file.")

20
lib/bforest/src/lib.rs

@ -16,13 +16,25 @@
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "std", warn(unstable_features))] #![cfg_attr(feature = "std", warn(unstable_features))]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(
#![cfg_attr(feature = "cargo-clippy", allow(new_without_default, new_without_default_derive))] feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr(
feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive)
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
warn( warn(
float_arithmetic, mut_mut, nonminimal_bool, option_map_unwrap_or, option_map_unwrap_or_else, float_arithmetic,
print_stdout, unicode_not_nfc, use_self mut_mut,
nonminimal_bool,
option_map_unwrap_or,
option_map_unwrap_or_else,
print_stdout,
unicode_not_nfc,
use_self
) )
)] )]
// Turns on no_std and alloc features if std is not available. // Turns on no_std and alloc features if std is not available.

3
lib/codegen/src/isa/x86/abi.rs

@ -99,8 +99,7 @@ impl ArgAssigner for Args {
RU::r14 RU::r14
} else { } else {
RU::rsi RU::rsi
} as RegUnit) } as RegUnit).into()
.into()
} }
// This is SpiderMonkey's `WasmTableCallSigReg`. // This is SpiderMonkey's `WasmTableCallSigReg`.
ArgumentPurpose::SignatureId => return ArgumentLoc::Reg(RU::r10 as RegUnit).into(), ArgumentPurpose::SignatureId => return ArgumentLoc::Reg(RU::r10 as RegUnit).into(),

6
lib/codegen/src/legalizer/boundary.rs

@ -569,8 +569,7 @@ pub fn handle_return_abi(inst: Inst, func: &mut Function, cfg: &ControlFlowGraph
rt.purpose == ArgumentPurpose::Link rt.purpose == ArgumentPurpose::Link
|| rt.purpose == ArgumentPurpose::StructReturn || rt.purpose == ArgumentPurpose::StructReturn
|| rt.purpose == ArgumentPurpose::VMContext || rt.purpose == ArgumentPurpose::VMContext
}) }).count();
.count();
let abi_args = func.signature.returns.len() - special_args; let abi_args = func.signature.returns.len() - special_args;
let pos = &mut FuncCursor::new(func).at_inst(inst); let pos = &mut FuncCursor::new(func).at_inst(inst);
@ -689,8 +688,7 @@ fn spill_call_arguments(pos: &mut FuncCursor) -> bool {
} }
_ => None, _ => None,
} }
}) }).collect::<Vec<_>>()
.collect::<Vec<_>>()
}; };
if arglist.is_empty() { if arglist.is_empty() {

15
lib/codegen/src/lib.rs

@ -3,7 +3,10 @@
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))] #![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( #![cfg_attr(feature="cargo-clippy", allow(
// This requires Rust 1.27 or later. // This requires Rust 1.27 or later.
duration_subsec, duration_subsec,
@ -32,8 +35,14 @@
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
warn( warn(
float_arithmetic, mut_mut, nonminimal_bool, option_map_unwrap_or, option_map_unwrap_or_else, float_arithmetic,
print_stdout, unicode_not_nfc, use_self mut_mut,
nonminimal_bool,
option_map_unwrap_or,
option_map_unwrap_or_else,
print_stdout,
unicode_not_nfc,
use_self
) )
)] )]
// Turns on no_std and alloc features if std is not available. // Turns on no_std and alloc features if std is not available.

3
lib/codegen/src/regalloc/coloring.rs

@ -902,8 +902,7 @@ impl<'a> Context<'a> {
} }
Table(jt) => { Table(jt) => {
let lr = &self.liveness[value]; let lr = &self.liveness[value];
!lr.is_local() !lr.is_local() && self.cur.func.jump_tables[jt]
&& self.cur.func.jump_tables[jt]
.entries() .entries()
.any(|(_, ebb)| lr.is_livein(ebb, ctx)) .any(|(_, ebb)| lr.is_livein(ebb, ctx))
} }

3
lib/codegen/src/regalloc/liveness.rs

@ -220,8 +220,7 @@ fn get_or_create<'a>(
func.dfg func.dfg
.call_signature(inst) .call_signature(inst)
.map(|sig| Affinity::abi(&func.dfg.signatures[sig].returns[rnum], isa)) .map(|sig| Affinity::abi(&func.dfg.signatures[sig].returns[rnum], isa))
}) }).unwrap_or_default();
.unwrap_or_default();
} }
ValueDef::Param(ebb, num) => { ValueDef::Param(ebb, num) => {
def = ebb.into(); def = ebb.into();

3
lib/codegen/src/regalloc/spilling.rs

@ -463,8 +463,7 @@ impl<'a> Context<'a> {
} }
} }
None None
}) }).min_by(|&a, &b| {
.min_by(|&a, &b| {
// Find the minimum candidate according to the RPO of their defs. // Find the minimum candidate according to the RPO of their defs.
self.domtree.rpo_cmp( self.domtree.rpo_cmp(
self.cur.func.dfg.value_def(a), self.cur.func.dfg.value_def(a),

3
lib/codegen/src/verifier/flags.rs

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

17
lib/codegen/src/verifier/mod.rs

@ -941,11 +941,11 @@ impl<'a> Verifier<'a> {
); );
} }
// The defining EBB dominates the instruction using this value. // The defining EBB dominates the instruction using this value.
if is_reachable if is_reachable && !self.expected_domtree.dominates(
&& !self ebb,
.expected_domtree loc_inst,
.dominates(ebb, loc_inst, &self.func.layout) &self.func.layout,
{ ) {
return fatal!( return fatal!(
errors, errors,
loc_inst, loc_inst,
@ -1039,7 +1039,8 @@ impl<'a> Verifier<'a> {
for (&prev_ebb, &next_ebb) in domtree.cfg_postorder().iter().adjacent_pairs() { for (&prev_ebb, &next_ebb) in domtree.cfg_postorder().iter().adjacent_pairs() {
if self if self
.expected_domtree .expected_domtree
.rpo_cmp(prev_ebb, next_ebb, &self.func.layout) != Ordering::Greater .rpo_cmp(prev_ebb, next_ebb, &self.func.layout)
!= Ordering::Greater
{ {
return fatal!( return fatal!(
errors, errors,
@ -1586,8 +1587,8 @@ impl<'a> Verifier<'a> {
let encoding = self.func.encodings[inst]; let encoding = self.func.encodings[inst];
if encoding.is_legal() { if encoding.is_legal() {
let mut encodings = let mut encodings = isa
isa.legal_encodings( .legal_encodings(
&self.func, &self.func,
&self.func.dfg[inst], &self.func.dfg[inst],
self.func.dfg.ctrl_typevar(inst), self.func.dfg.ctrl_typevar(inst),

20
lib/entity/src/lib.rs

@ -32,13 +32,25 @@
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))] #![cfg_attr(feature = "std", deny(unstable_features))]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(
#![cfg_attr(feature = "cargo-clippy", allow(new_without_default, new_without_default_derive))] feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr(
feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive)
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
warn( warn(
float_arithmetic, mut_mut, nonminimal_bool, option_map_unwrap_or, option_map_unwrap_or_else, float_arithmetic,
print_stdout, unicode_not_nfc, use_self mut_mut,
nonminimal_bool,
option_map_unwrap_or,
option_map_unwrap_or_else,
print_stdout,
unicode_not_nfc,
use_self
) )
)] )]
// Turns on no_std and alloc features if std is not available. // Turns on no_std and alloc features if std is not available.

9
lib/faerie/src/backend.rs

@ -228,8 +228,7 @@ impl Backend for FaerieBackend {
from: name, from: name,
to, to,
at: u64::from(offset), 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 { for &(offset, id, addend) in data_relocs {
debug_assert_eq!( debug_assert_eq!(
@ -242,8 +241,7 @@ impl Backend for FaerieBackend {
from: name, from: name,
to, to,
at: u64::from(offset), at: u64::from(offset),
}) }).map_err(|e| ModuleError::Backend(e.to_string()))?;
.map_err(|e| ModuleError::Backend(e.to_string()))?;
} }
self.artifact self.artifact
@ -409,8 +407,7 @@ impl<'a> RelocSink for FaerieRelocSink<'a> {
reloc: raw_reloc, reloc: raw_reloc,
addend: addend_i32, addend: addend_i32,
}, },
) ).expect("faerie relocation error");
.expect("faerie relocation error");
} }
fn reloc_jt(&mut self, _offset: CodeOffset, _reloc: Reloc, _jt: ir::JumpTable) { fn reloc_jt(&mut self, _offset: CodeOffset, _reloc: Reloc, _jt: ir::JumpTable) {

27
lib/faerie/src/lib.rs

@ -2,15 +2,32 @@
//! //!
//! Users of this module should not have to depend on faerie directly. //! Users of this module should not have to depend on faerie directly.
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates, unstable_features)] #![deny(
missing_docs,
trivial_numeric_casts,
unused_extern_crates,
unstable_features
)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(
#![cfg_attr(feature = "cargo-clippy", allow(new_without_default, new_without_default_derive))] feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr(
feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive)
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
warn( warn(
float_arithmetic, mut_mut, nonminimal_bool, option_map_unwrap_or, option_map_unwrap_or_else, float_arithmetic,
print_stdout, unicode_not_nfc, use_self mut_mut,
nonminimal_bool,
option_map_unwrap_or,
option_map_unwrap_or_else,
print_stdout,
unicode_not_nfc,
use_self
) )
)] )]

6
lib/filetests/src/concurrent.rs

@ -106,8 +106,7 @@ fn heartbeat_thread(replies: Sender<Reply>) -> thread::JoinHandle<()> {
while replies.send(Reply::Tick).is_ok() { while replies.send(Reply::Tick).is_ok() {
thread::sleep(Duration::from_secs(1)); thread::sleep(Duration::from_secs(1));
} }
}) }).unwrap()
.unwrap()
} }
/// Spawn a worker thread running tests. /// Spawn a worker thread running tests.
@ -154,6 +153,5 @@ fn worker_thread(
// Timing is accumulated independently per thread. // Timing is accumulated independently per thread.
// Timings from this worker thread will be aggregated by `ConcurrentRunner::join()`. // Timings from this worker thread will be aggregated by `ConcurrentRunner::join()`.
timing::take_current() timing::take_current()
}) }).unwrap()
.unwrap()
} }

13
lib/filetests/src/lib.rs

@ -3,7 +3,12 @@
//! This crate contains the main test driver as well as implementations of the //! This crate contains the main test driver as well as implementations of the
//! available filetest commands. //! available filetest commands.
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates, unstable_features)] #![deny(
missing_docs,
trivial_numeric_casts,
unused_extern_crates,
unstable_features
)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "cargo-clippy", #![cfg_attr(feature = "cargo-clippy",
allow( allow(
@ -13,7 +18,11 @@
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
warn( warn(
mut_mut, nonminimal_bool, option_map_unwrap_or, option_map_unwrap_or_else, unicode_not_nfc, mut_mut,
nonminimal_bool,
option_map_unwrap_or,
option_map_unwrap_or_else,
unicode_not_nfc,
use_self use_self
) )
)] )]

3
lib/filetests/src/runner.rs

@ -315,8 +315,7 @@ impl TestRunner {
.. ..
} => Some(dur), } => Some(dur),
_ => None, _ => None,
}) }).collect::<Vec<_>>();
.collect::<Vec<_>>();
// Get me some real data, kid. // Get me some real data, kid.
let len = times.len(); let len = times.len();

3
lib/frontend/src/frontend.rs

@ -517,8 +517,7 @@ impl<'a> FunctionBuilder<'a> {
None => false, None => false,
Some(entry) => self.position.ebb.unwrap() == entry, Some(entry) => self.position.ebb.unwrap() == entry,
}; };
!is_entry && self.func_ctx.ssa.is_sealed(self.position.ebb.unwrap()) !is_entry && self.func_ctx.ssa.is_sealed(self.position.ebb.unwrap()) && !self
&& !self
.func_ctx .func_ctx
.ssa .ssa
.has_any_predecessors(self.position.ebb.unwrap()) .has_any_predecessors(self.position.ebb.unwrap())

10
lib/frontend/src/lib.rs

@ -163,8 +163,14 @@
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
warn( warn(
float_arithmetic, mut_mut, nonminimal_bool, option_map_unwrap_or, option_map_unwrap_or_else, float_arithmetic,
print_stdout, unicode_not_nfc, use_self mut_mut,
nonminimal_bool,
option_map_unwrap_or,
option_map_unwrap_or_else,
print_stdout,
unicode_not_nfc,
use_self
) )
)] )]
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]

20
lib/module/src/lib.rs

@ -3,13 +3,25 @@
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))] #![cfg_attr(feature = "std", deny(unstable_features))]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(
#![cfg_attr(feature = "cargo-clippy", allow(new_without_default, new_without_default_derive))] feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr(
feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive)
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
warn( warn(
float_arithmetic, mut_mut, nonminimal_bool, option_map_unwrap_or, option_map_unwrap_or_else, float_arithmetic,
print_stdout, unicode_not_nfc, use_self mut_mut,
nonminimal_bool,
option_map_unwrap_or,
option_map_unwrap_or_else,
print_stdout,
unicode_not_nfc,
use_self
) )
)] )]
// Turns on no_std and alloc features if std is not available. // Turns on no_std and alloc features if std is not available.

5
lib/module/src/module.rs

@ -129,7 +129,10 @@ pub enum ModuleError {
#[fail(display = "Duplicate definition of identifier: {}", _0)] #[fail(display = "Duplicate definition of identifier: {}", _0)]
DuplicateDefinition(String), DuplicateDefinition(String),
/// Indicates an identifier was defined, but was declared as an import /// 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), InvalidImportDefinition(String),
/// Wraps a `cranelift-codegen` error /// Wraps a `cranelift-codegen` error
#[fail(display = "Compilation error: {}", _0)] #[fail(display = "Compilation error: {}", _0)]

27
lib/native/src/lib.rs

@ -1,15 +1,32 @@
//! Performs autodetection of the host for the purposes of running //! Performs autodetection of the host for the purposes of running
//! Cranelift to generate code to run on the same machine. //! Cranelift to generate code to run on the same machine.
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates, unstable_features)] #![deny(
missing_docs,
trivial_numeric_casts,
unused_extern_crates,
unstable_features
)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(
#![cfg_attr(feature = "cargo-clippy", allow(new_without_default, new_without_default_derive))] feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr(
feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive)
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
warn( warn(
float_arithmetic, mut_mut, nonminimal_bool, option_map_unwrap_or, option_map_unwrap_or_else, float_arithmetic,
print_stdout, unicode_not_nfc, use_self mut_mut,
nonminimal_bool,
option_map_unwrap_or,
option_map_unwrap_or_else,
print_stdout,
unicode_not_nfc,
use_self
) )
)] )]
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]

3
lib/reader/src/lexer.rs

@ -322,8 +322,7 @@ impl<'a> Lexer<'a> {
.and_then(|(prefix, number)| { .and_then(|(prefix, number)| {
Self::numbered_entity(prefix, number) Self::numbered_entity(prefix, number)
.or_else(|| Self::value_type(text, 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), "iflags" => Token::Type(types::IFLAGS),
"fflags" => Token::Type(types::FFLAGS), "fflags" => Token::Type(types::FFLAGS),
_ => Token::Identifier(text), _ => Token::Identifier(text),

27
lib/reader/src/lib.rs

@ -3,15 +3,32 @@
//! The `cranelift_reader` library supports reading .clif files. This functionality is needed for //! The `cranelift_reader` library supports reading .clif files. This functionality is needed for
//! testing Cranelift, but is not essential for a JIT compiler. //! testing Cranelift, but is not essential for a JIT compiler.
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates, unstable_features)] #![deny(
missing_docs,
trivial_numeric_casts,
unused_extern_crates,
unstable_features
)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(
#![cfg_attr(feature = "cargo-clippy", allow(new_without_default, new_without_default_derive))] feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr(
feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive)
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
warn( warn(
float_arithmetic, mut_mut, nonminimal_bool, option_map_unwrap_or, option_map_unwrap_or_else, float_arithmetic,
print_stdout, unicode_not_nfc, use_self mut_mut,
nonminimal_bool,
option_map_unwrap_or,
option_map_unwrap_or_else,
print_stdout,
unicode_not_nfc,
use_self
) )
)] )]

7
lib/reader/src/parser.rs

@ -969,9 +969,10 @@ impl<'a> Parser<'a> {
self.consume(); self.consume();
match self.token() { match self.token() {
Some(Token::Integer(index_str)) => { Some(Token::Integer(index_str)) => {
let index: u32 = u32::from_str_radix(index_str, 10).map_err( let index: u32 =
|_| self.error("the integer given overflows the u32 type"), u32::from_str_radix(index_str, 10).map_err(|_| {
)?; self.error("the integer given overflows the u32 type")
})?;
self.consume(); self.consume();
Ok(ExternalName::user(namespace, index)) Ok(ExternalName::user(namespace, index))
} }

32
lib/serde/src/clif-json.rs

@ -1,14 +1,30 @@
//! Utility for `cranelift_serde`. //! Utility for `cranelift_serde`.
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates, unstable_features)] #![deny(
missing_docs,
trivial_numeric_casts,
unused_extern_crates,
unstable_features
)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(
#![cfg_attr(feature = "cargo-clippy", allow(new_without_default, new_without_default_derive))] feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr(
feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive)
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
warn( warn(
float_arithmetic, mut_mut, nonminimal_bool, option_map_unwrap_or, option_map_unwrap_or_else, float_arithmetic,
unicode_not_nfc, use_self mut_mut,
nonminimal_bool,
option_map_unwrap_or,
option_map_unwrap_or_else,
unicode_not_nfc,
use_self
) )
)] )]
@ -67,8 +83,7 @@ fn main() {
.value_name("FILE") .value_name("FILE")
.help("Input file for serialization"), .help("Input file for serialization"),
), ),
) ).subcommand(
.subcommand(
SubCommand::with_name("deserialize") SubCommand::with_name("deserialize")
.about("Deserializes Cranelift IR into JSON.") .about("Deserializes Cranelift IR into JSON.")
.arg( .arg(
@ -77,8 +92,7 @@ fn main() {
.value_name("FILE") .value_name("FILE")
.help("Input file for deserialization"), .help("Input file for deserialization"),
), ),
) ).get_matches();
.get_matches();
let res_serde = match matches.subcommand() { let res_serde = match matches.subcommand() {
("serialize", Some(m)) => { ("serialize", Some(m)) => {

27
lib/simplejit/src/lib.rs

@ -1,14 +1,31 @@
//! Top-level lib.rs for `cranelift_simplejit`. //! Top-level lib.rs for `cranelift_simplejit`.
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates, unstable_features)] #![deny(
missing_docs,
trivial_numeric_casts,
unused_extern_crates,
unstable_features
)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(
#![cfg_attr(feature = "cargo-clippy", allow(new_without_default, new_without_default_derive))] feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr(
feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive)
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
warn( warn(
float_arithmetic, mut_mut, nonminimal_bool, option_map_unwrap_or, option_map_unwrap_or_else, float_arithmetic,
print_stdout, unicode_not_nfc, use_self mut_mut,
nonminimal_bool,
option_map_unwrap_or,
option_map_unwrap_or_else,
print_stdout,
unicode_not_nfc,
use_self
) )
)] )]

27
lib/umbrella/src/lib.rs

@ -1,14 +1,31 @@
//! Cranelift umbrella crate, providing a convenient one-line dependency. //! Cranelift umbrella crate, providing a convenient one-line dependency.
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates, unstable_features)] #![deny(
missing_docs,
trivial_numeric_casts,
unused_extern_crates,
unstable_features
)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(
#![cfg_attr(feature = "cargo-clippy", allow(new_without_default, new_without_default_derive))] feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr(
feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive)
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
warn( warn(
float_arithmetic, mut_mut, nonminimal_bool, option_map_unwrap_or, option_map_unwrap_or_else, float_arithmetic,
print_stdout, unicode_not_nfc, use_self mut_mut,
nonminimal_bool,
option_map_unwrap_or,
option_map_unwrap_or_else,
print_stdout,
unicode_not_nfc,
use_self
) )
)] )]

6
lib/wasm/src/environ/spec.rs

@ -35,7 +35,11 @@ pub enum WasmError {
/// ///
/// This error code is used by a WebAssembly translator when it encounters invalid WebAssembly /// This error code is used by a WebAssembly translator when it encounters invalid WebAssembly
/// code. This should never happen for validated WebAssembly code. /// 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 { InvalidWebAssembly {
/// A string describing the validation error. /// A string describing the validation error.
message: &'static str, message: &'static str,

20
lib/wasm/src/lib.rs

@ -12,13 +12,25 @@
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))] #![cfg_attr(feature = "std", deny(unstable_features))]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(
#![cfg_attr(feature = "cargo-clippy", allow(new_without_default, new_without_default_derive))] feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr(
feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive)
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
warn( warn(
float_arithmetic, mut_mut, nonminimal_bool, option_map_unwrap_or, option_map_unwrap_or_else, float_arithmetic,
print_stdout, unicode_not_nfc, use_self mut_mut,
nonminimal_bool,
option_map_unwrap_or,
option_map_unwrap_or_else,
print_stdout,
unicode_not_nfc,
use_self
) )
)] )]
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]

3
lib/wasm/tests/wasm_testsuite.rs

@ -30,8 +30,7 @@ fn testsuite() {
} }
} }
false false
}) }).collect();
.collect();
paths.sort_by_key(|dir| dir.path()); paths.sort_by_key(|dir| dir.path());
let flags = Flags::new(settings::builder()); let flags = Flags::new(settings::builder());
for path in paths { for path in paths {

Loading…
Cancel
Save