rustfmt 0.8.1

This commit is contained in:
Jakob Stoklund Olesen
2017-04-05 09:00:11 -07:00
parent e641c97670
commit 1984c96f7c
38 changed files with 497 additions and 334 deletions

View File

@@ -119,10 +119,11 @@ 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,
})
replies
.send(Reply::Starting {
jobid: jobid,
thread_num: thread_num,
})
.unwrap();
let result = catch_unwind(|| runone::run(path.as_path())).unwrap_or_else(|e| {
@@ -141,10 +142,11 @@ fn worker_thread(thread_num: usize,
dbg!("FAIL: {}", msg);
}
replies.send(Reply::Done {
jobid: jobid,
result: result,
})
replies
.send(Reply::Done {
jobid: jobid,
result: result,
})
.unwrap();
}
})

View File

@@ -41,7 +41,8 @@ impl SubTest for TestLegalizer {
comp_ctx.flowgraph();
comp_ctx.legalize(isa);
comp_ctx.verify(isa).map_err(|e| pretty_verifier_error(&comp_ctx.func, e))?;
comp_ctx.verify(isa)
.map_err(|e| pretty_verifier_error(&comp_ctx.func, e))?;
let mut text = String::new();
write_function(&mut text, &comp_ctx.func, Some(isa)).map_err(|e| e.to_string())?;

View File

@@ -47,7 +47,8 @@ impl SubTest for TestRegalloc {
// TODO: Should we have an option to skip legalization?
comp_ctx.legalize(isa);
comp_ctx.regalloc(isa);
comp_ctx.verify(isa).map_err(|e| pretty_verifier_error(&comp_ctx.func, e))?;
comp_ctx.verify(isa)
.map_err(|e| pretty_verifier_error(&comp_ctx.func, e))?;
let mut text = String::new();
write_function(&mut text, &comp_ctx.func, Some(isa)).map_err(|e| e.to_string())?;

View File

@@ -104,10 +104,11 @@ impl TestRunner {
///
/// Any problems reading `file` as a test case file will be reported as a test failure.
pub fn push_test<P: Into<PathBuf>>(&mut self, file: P) {
self.tests.push(QueueEntry {
path: file.into(),
state: State::New,
});
self.tests
.push(QueueEntry {
path: file.into(),
state: State::New,
});
}
/// Begin running tests concurrently.
@@ -206,7 +207,9 @@ impl TestRunner {
}
// Check for any asynchronous replies without blocking.
while let Some(reply) = self.threads.as_mut().and_then(ConcurrentRunner::try_get) {
while let Some(reply) = self.threads
.as_mut()
.and_then(ConcurrentRunner::try_get) {
self.handle_reply(reply);
}
}
@@ -303,12 +306,12 @@ impl TestRunner {
return;
}
for t in self.tests.iter().filter(|entry| match **entry {
QueueEntry { state: State::Done(Ok(dur)), .. } => {
dur > cut
}
_ => false,
}) {
for t in self.tests
.iter()
.filter(|entry| match **entry {
QueueEntry { state: State::Done(Ok(dur)), .. } => dur > cut,
_ => false,
}) {
println!("slow: {}", t)
}

View File

@@ -120,5 +120,6 @@ fn run_one_test<'a>(tuple: (&'a SubTest, &'a Flags, Option<&'a TargetIsa>),
context.verified = true;
}
test.run(func, context).map_err(|e| format!("{}: {}", name, e))
test.run(func, context)
.map_err(|e| format!("{}: {}", name, e))
}

View File

@@ -76,11 +76,13 @@ impl<'a> filecheck::VariableMap for Context<'a> {
/// Run filecheck on `text`, using directives extracted from `context`.
pub fn run_filecheck(text: &str, context: &Context) -> Result<()> {
let checker = build_filechecker(context)?;
if checker.check(&text, context).map_err(|e| format!("filecheck: {}", e))? {
if checker.check(&text, context)
.map_err(|e| format!("filecheck: {}", e))? {
Ok(())
} else {
// Filecheck mismatch. Emit an explanation as output.
let (_, explain) = checker.explain(&text, context).map_err(|e| format!("explain: {}", e))?;
let (_, explain) = checker.explain(&text, context)
.map_err(|e| format!("explain: {}", e))?;
Err(format!("filecheck failed:\n{}{}", checker, explain))
}
}
@@ -90,10 +92,12 @@ pub fn build_filechecker(context: &Context) -> Result<Checker> {
let mut builder = CheckerBuilder::new();
// Preamble comments apply to all functions.
for comment in context.preamble_comments {
builder.directive(comment.text).map_err(|e| format!("filecheck: {}", e))?;
builder.directive(comment.text)
.map_err(|e| format!("filecheck: {}", e))?;
}
for comment in &context.details.comments {
builder.directive(comment.text).map_err(|e| format!("filecheck: {}", e))?;
builder.directive(comment.text)
.map_err(|e| format!("filecheck: {}", e))?;
}
let checker = builder.finish();
if checker.is_empty() {