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

This commit is contained in:
Dan Gohman
2018-12-06 16:15:48 -05:00
parent 323a9925e5
commit 5adab629f2
43 changed files with 181 additions and 177 deletions

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -89,7 +89,8 @@ impl RegBank {
None
}
}
}.and_then(|offset| {
}
.and_then(|offset| {
if offset < self.units {
Some(offset + self.first_unit)
} else {

View File

@@ -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(),

View File

@@ -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::<Vec<_>>()
})
.collect::<Vec<_>>()
};
if arglist.is_empty() {

View File

@@ -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

View File

@@ -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,

View File

@@ -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
}

View File

@@ -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)))
}
}
}

View File

@@ -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());

View File

@@ -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();

View File

@@ -207,7 +207,8 @@ impl<'a> fmt::Display for DisplayRegisterSet<'a> {
.unwrap_or_else(|| char::from_digit(
u32::from(offset % 10),
10
).unwrap())
)
.unwrap())
)?;
}
}

View File

@@ -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

View File

@@ -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),

View File

@@ -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<Pass> = Cell::new(Pass::None);
static PASS_TIME: RefCell<PassTimes> = RefCell::new(Default::default());
}

View File

@@ -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!(