Update rustfmt to 0.9.0.
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user