From 15606fa7354d2ba806fa255873ff946c7ed9a31a Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Thu, 27 Apr 2017 12:52:41 -0700 Subject: [PATCH] Upgrade to rustfmt 0.8.3. --- src/cat.rs | 6 ++++-- src/filetest/legalizer.rs | 6 ++++-- src/filetest/regalloc.rs | 9 ++++++--- src/filetest/runone.rs | 6 ++++-- src/filetest/subtest.rs | 12 ++++++++---- src/print_cfg.rs | 6 ++++-- src/rsfilecheck.rs | 18 ++++++++++++------ test-all.sh | 2 +- 8 files changed, 43 insertions(+), 22 deletions(-) diff --git a/src/cat.rs b/src/cat.rs index fd49722ec0..a53d3b4294 100644 --- a/src/cat.rs +++ b/src/cat.rs @@ -21,8 +21,10 @@ pub fn run(files: Vec) -> CommandResult { } fn cat_one(filename: String) -> CommandResult { - let buffer = read_to_string(&filename).map_err(|e| format!("{}: {}", filename, e))?; - let items = parse_functions(&buffer).map_err(|e| format!("{}: {}", filename, e))?; + let buffer = read_to_string(&filename) + .map_err(|e| format!("{}: {}", filename, e))?; + let items = parse_functions(&buffer) + .map_err(|e| format!("{}: {}", filename, e))?; for (idx, func) in items.into_iter().enumerate() { if idx != 0 { diff --git a/src/filetest/legalizer.rs b/src/filetest/legalizer.rs index c6e08ffe29..8fd7f45b16 100644 --- a/src/filetest/legalizer.rs +++ b/src/filetest/legalizer.rs @@ -40,11 +40,13 @@ impl SubTest for TestLegalizer { let isa = context.isa.expect("legalizer needs an ISA"); comp_ctx.flowgraph(); - comp_ctx.legalize(isa) + comp_ctx + .legalize(isa) .map_err(|e| pretty_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())?; + write_function(&mut text, &comp_ctx.func, Some(isa)) + .map_err(|e| e.to_string())?; run_filecheck(&text, context) } } diff --git a/src/filetest/regalloc.rs b/src/filetest/regalloc.rs index 87045eb764..79e7ad8e0f 100644 --- a/src/filetest/regalloc.rs +++ b/src/filetest/regalloc.rs @@ -45,13 +45,16 @@ impl SubTest for TestRegalloc { comp_ctx.flowgraph(); // TODO: Should we have an option to skip legalization? - comp_ctx.legalize(isa) + comp_ctx + .legalize(isa) .map_err(|e| pretty_error(&comp_ctx.func, e))?; - comp_ctx.regalloc(isa) + comp_ctx + .regalloc(isa) .map_err(|e| pretty_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())?; + write_function(&mut text, &comp_ctx.func, Some(isa)) + .map_err(|e| e.to_string())?; run_filecheck(&text, context) } } diff --git a/src/filetest/runone.rs b/src/filetest/runone.rs index 621f2bfd6a..b43d926f0e 100644 --- a/src/filetest/runone.rs +++ b/src/filetest/runone.rs @@ -26,7 +26,8 @@ pub fn run(path: &Path) -> TestResult { } // Parse the test commands. - let mut tests = testfile.commands + let mut tests = testfile + .commands .iter() .map(new_subtest) .collect::>>()?; @@ -116,7 +117,8 @@ fn run_one_test<'a>(tuple: (&'a SubTest, &'a Flags, Option<&'a TargetIsa>), // Should we run the verifier before this test? if !context.verified && test.needs_verifier() { - verify_function(&func, isa).map_err(|e| pretty_verifier_error(&func, e))?; + verify_function(&func, isa) + .map_err(|e| pretty_verifier_error(&func, e))?; context.verified = true; } diff --git a/src/filetest/subtest.rs b/src/filetest/subtest.rs index 923439d490..9c7159dbb5 100644 --- a/src/filetest/subtest.rs +++ b/src/filetest/subtest.rs @@ -76,12 +76,14 @@ 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) + 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) + let (_, explain) = checker + .explain(&text, context) .map_err(|e| format!("explain: {}", e))?; Err(format!("filecheck failed:\n{}{}", checker, explain)) } @@ -92,11 +94,13 @@ pub fn build_filechecker(context: &Context) -> Result { let mut builder = CheckerBuilder::new(); // Preamble comments apply to all functions. for comment in context.preamble_comments { - builder.directive(comment.text) + builder + .directive(comment.text) .map_err(|e| format!("filecheck: {}", e))?; } for comment in &context.details.comments { - builder.directive(comment.text) + builder + .directive(comment.text) .map_err(|e| format!("filecheck: {}", e))?; } let checker = builder.finish(); diff --git a/src/print_cfg.rs b/src/print_cfg.rs index 1d5deff68c..ec479e3c92 100644 --- a/src/print_cfg.rs +++ b/src/print_cfg.rs @@ -91,8 +91,10 @@ impl<'a> Display for CFGPrinter<'a> { } fn print_cfg(filename: String) -> CommandResult { - let buffer = read_to_string(&filename).map_err(|e| format!("{}: {}", filename, e))?; - let items = parse_functions(&buffer).map_err(|e| format!("{}: {}", filename, e))?; + let buffer = read_to_string(&filename) + .map_err(|e| format!("{}: {}", filename, e))?; + let items = parse_functions(&buffer) + .map_err(|e| format!("{}: {}", filename, e))?; for (idx, func) in items.into_iter().enumerate() { if idx != 0 { diff --git a/src/rsfilecheck.rs b/src/rsfilecheck.rs index 79d913bce9..5ee464d20a 100644 --- a/src/rsfilecheck.rs +++ b/src/rsfilecheck.rs @@ -18,11 +18,13 @@ pub fn run(files: Vec, verbose: bool) -> CommandResult { } let mut buffer = String::new(); - io::stdin().read_to_string(&mut buffer) + io::stdin() + .read_to_string(&mut buffer) .map_err(|e| format!("stdin: {}", e))?; if verbose { - let (success, explain) = checker.explain(&buffer, NO_VARIABLES) + let (success, explain) = checker + .explain(&buffer, NO_VARIABLES) .map_err(|e| e.to_string())?; print!("{}", explain); if success { @@ -31,11 +33,13 @@ pub fn run(files: Vec, verbose: bool) -> CommandResult { } else { Err("Check failed".to_string()) } - } else if checker.check(&buffer, NO_VARIABLES) + } else if checker + .check(&buffer, NO_VARIABLES) .map_err(|e| e.to_string())? { Ok(()) } else { - let (_, explain) = checker.explain(&buffer, NO_VARIABLES) + let (_, explain) = checker + .explain(&buffer, NO_VARIABLES) .map_err(|e| e.to_string())?; print!("{}", explain); Err("Check failed".to_string()) @@ -43,9 +47,11 @@ pub fn run(files: Vec, verbose: bool) -> CommandResult { } fn read_checkfile(filename: &str) -> Result { - let buffer = read_to_string(&filename).map_err(|e| format!("{}: {}", filename, e))?; + let buffer = read_to_string(&filename) + .map_err(|e| format!("{}: {}", filename, e))?; let mut builder = CheckerBuilder::new(); - builder.text(&buffer) + builder + .text(&buffer) .map_err(|e| format!("{}: {}", filename, e))?; Ok(builder.finish()) } diff --git a/test-all.sh b/test-all.sh index 5b718d8bc4..d387cae46d 100755 --- a/test-all.sh +++ b/test-all.sh @@ -30,7 +30,7 @@ function banner() { # rustfmt is installed. # # This version should always be bumped to the newest version available. -RUSTFMT_VERSION="0.8.1" +RUSTFMT_VERSION="0.8.3" if cargo install --list | grep -q "^rustfmt v$RUSTFMT_VERSION"; then banner "Rust formatting"