Update rustfmt to 0.9.0.

This commit is contained in:
Dan Gohman
2017-08-31 10:44:59 -07:00
parent 46fb64cbb4
commit 2efdc0ed37
111 changed files with 4692 additions and 3379 deletions

View File

@@ -66,25 +66,25 @@ 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())
})
}
}
/// 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))
}
}
@@ -94,14 +94,14 @@ 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() {