Update to rustfmt-preview (#348)

* Update to rustfmt-preview.

* Run "cargo fmt --all" with rustfmt 0.4.1.

rustfmt 0.4.1 is the latest release of rustfmt-preview available on the
stable channel.

* Fix a long line that rustfmt 0.4.1 can't handle.

* Remove unneeded commas left behind by rustfmt.
This commit is contained in:
Dan Gohman
2018-05-25 11:38:38 -07:00
committed by GitHub
parent 99f6055c55
commit 6b88cd44a8
137 changed files with 1914 additions and 2380 deletions

View File

@@ -138,9 +138,9 @@ impl SubTest for TestBinEmit {
&func.dfg[inst],
func.dfg.ctrl_typevar(inst),
).filter(|e| {
let recipe_constraints = &encinfo.constraints[e.recipe()];
recipe_constraints.satisfied(inst, &divert, &func)
});
let recipe_constraints = &encinfo.constraints[e.recipe()];
recipe_constraints.satisfied(inst, &divert, &func)
});
if opt_level == OptLevel::Best {
// Get the smallest legal encoding
@@ -149,8 +149,7 @@ impl SubTest for TestBinEmit {
// If not optimizing, just use the first encoding.
legal_encodings.next()
}
}
{
} {
func.encodings[inst] = enc;
}
}
@@ -159,9 +158,8 @@ impl SubTest for TestBinEmit {
}
// Relax branches and compute EBB offsets based on the encodings.
let code_size = binemit::relax_branches(&mut func, isa).map_err(|e| {
pretty_error(&func, context.isa, e)
})?;
let code_size = binemit::relax_branches(&mut func, isa)
.map_err(|e| pretty_error(&func, context.isa, e))?;
// Collect all of the 'bin:' directives on instructions.
let mut bins = HashMap::new();
@@ -181,8 +179,7 @@ impl SubTest for TestBinEmit {
_ => {
return Err(format!(
"'bin:' directive on non-inst {}: {}",
comment.entity,
comment.text
comment.entity, comment.text
))
}
}
@@ -198,8 +195,7 @@ impl SubTest for TestBinEmit {
divert.clear();
// Correct header offsets should have been computed by `relax_branches()`.
assert_eq!(
sink.offset,
func.offsets[ebb],
sink.offset, func.offsets[ebb],
"Inconsistent {} header offset",
ebb
);
@@ -211,9 +207,10 @@ impl SubTest for TestBinEmit {
// Send legal encodings into the emitter.
if enc.is_legal() {
// Generate a better error message if output locations are not specified.
if let Some(&v) = func.dfg.inst_results(inst).iter().find(|&&v| {
!func.locations[v].is_assigned()
})
if let Some(&v) = func.dfg
.inst_results(inst)
.iter()
.find(|&&v| !func.locations[v].is_assigned())
{
return Err(format!(
"Missing register/stack slot for {} in {}",
@@ -239,9 +236,10 @@ impl SubTest for TestBinEmit {
if !enc.is_legal() {
// A possible cause of an unencoded instruction is a missing location for
// one of the input operands.
if let Some(&v) = func.dfg.inst_args(inst).iter().find(|&&v| {
!func.locations[v].is_assigned()
})
if let Some(&v) = func.dfg
.inst_args(inst)
.iter()
.find(|&&v| !func.locations[v].is_assigned())
{
return Err(format!(
"Missing register/stack slot for {} in {}",
@@ -287,8 +285,7 @@ impl SubTest for TestBinEmit {
if sink.offset != code_size {
return Err(format!(
"Expected code size {}, got {}",
code_size,
sink.offset
code_size, sink.offset
));
}