Upgrade to rustfmt 0.8.0.

Lots of changes this time.

Worked around what looks like a rustfmt bug in parse_inst_operands where
a large match was nested inside Ok().
This commit is contained in:
Jakob Stoklund Olesen
2017-03-14 10:48:05 -07:00
parent 849f3f3e9b
commit 32709a56ca
37 changed files with 462 additions and 377 deletions

View File

@@ -51,11 +51,7 @@ pub type CommandResult = Result<(), String>;
fn cton_util() -> CommandResult {
// Parse comand line arguments.
let args: Args = Docopt::new(USAGE)
.and_then(|d| {
d.help(true)
.version(Some(format!("Cretonne {}", VERSION)))
.decode()
})
.and_then(|d| d.help(true).version(Some(format!("Cretonne {}", VERSION))).decode())
.unwrap_or_else(|e| e.exit());
// Find the sub-command to execute.

View File

@@ -97,8 +97,8 @@ fn heartbeat_thread(replies: Sender<Reply>) -> thread::JoinHandle<()> {
thread::Builder::new()
.name("heartbeat".to_string())
.spawn(move || while replies.send(Reply::Tick).is_ok() {
thread::sleep(Duration::from_secs(1));
})
thread::sleep(Duration::from_secs(1));
})
.unwrap()
}
@@ -120,9 +120,9 @@ 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,
})
jobid: jobid,
thread_num: thread_num,
})
.unwrap();
let result = catch_unwind(|| runone::run(path.as_path())).unwrap_or_else(|e| {
@@ -138,9 +138,9 @@ fn worker_thread(thread_num: usize,
});
replies.send(Reply::Done {
jobid: jobid,
result: result,
})
jobid: jobid,
result: result,
})
.unwrap();
}
})

View File

@@ -89,7 +89,10 @@ impl SubTest for TestDomtree {
// Now we know that everything in `expected` is consistent with `domtree`.
// All other EBB's should be either unreachable or the entry block.
for ebb in func.layout.ebbs().skip(1).filter(|ebb| !expected.contains_key(&ebb)) {
for ebb in func.layout
.ebbs()
.skip(1)
.filter(|ebb| !expected.contains_key(&ebb)) {
if let Some(got_inst) = domtree.idom(ebb) {
return Err(format!("mismatching idoms for renumbered {}:\n\
want: unrechable, got: {}",

View File

@@ -105,9 +105,9 @@ 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,
});
path: file.into(),
state: State::New,
});
}
/// Begin running tests concurrently.
@@ -277,9 +277,9 @@ impl TestRunner {
let mut times = self.tests
.iter()
.filter_map(|entry| match *entry {
QueueEntry { state: State::Done(Ok(dur)), .. } => Some(dur),
_ => None,
})
QueueEntry { state: State::Done(Ok(dur)), .. } => Some(dur),
_ => None,
})
.collect::<Vec<_>>();
// Get me some real data, kid.
@@ -303,12 +303,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

@@ -25,7 +25,10 @@ pub fn run(path: &Path) -> TestResult {
}
// Parse the test commands.
let mut tests = testfile.commands.iter().map(new_subtest).collect::<Result<Vec<_>>>()?;
let mut tests = testfile.commands
.iter()
.map(new_subtest)
.collect::<Result<Vec<_>>>()?;
// Flags to use for those tests that don't need an ISA.
// This is the cumulative effect of all the `set` commands in the file.

View File

@@ -66,7 +66,10 @@ pub trait SubTest {
/// match 'inst10'.
impl<'a> filecheck::VariableMap for Context<'a> {
fn lookup(&self, varname: &str) -> Option<FCValue> {
self.details.map.lookup_str(varname).map(|e| FCValue::Regex(format!(r"\b{}\b", e).into()))
self.details
.map
.lookup_str(varname)
.map(|e| FCValue::Regex(format!(r"\b{}\b", e).into()))
}
}
@@ -77,8 +80,7 @@ pub fn run_filecheck(text: &str, context: &Context) -> Result<()> {
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))
}
}

View File

@@ -21,8 +21,7 @@ pub fn run(files: Vec<String>, verbose: bool) -> CommandResult {
io::stdin().read_to_string(&mut buffer).map_err(|e| format!("stdin: {}", e))?;
if verbose {
let (success, explain) = checker.explain(&buffer, NO_VARIABLES)
.map_err(|e| e.to_string())?;
let (success, explain) = checker.explain(&buffer, NO_VARIABLES).map_err(|e| e.to_string())?;
print!("{}", explain);
if success {
println!("OK");