From fa75ef466396a48d5aac03a83ac2c92f89f3bf2e Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Thu, 15 Mar 2018 14:06:54 +1300 Subject: [PATCH] fixup tests --- tests/lib.rs | 4 ++-- tests/source/imports.rs | 1 + tests/target/import-fencepost-length.rs | 2 +- tests/target/imports-reorder-lines-and-items.rs | 6 +++--- tests/target/imports-reorder-lines.rs | 10 +++++----- tests/target/imports.rs | 4 ++-- tests/target/issue-1124.rs | 6 ++++-- tests/target/issue-2256.rs | 1 + 8 files changed, 19 insertions(+), 15 deletions(-) diff --git a/tests/lib.rs b/tests/lib.rs index e98de537b0c..8c4d67575dc 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -23,11 +23,11 @@ use std::path::{Path, PathBuf}; use std::str::Chars; -use rustfmt::*; -use rustfmt::config::{Color, Config, ReportTactic}; use rustfmt::config::summary::Summary; +use rustfmt::config::{Color, Config, ReportTactic}; use rustfmt::filemap::write_system_newlines; use rustfmt::rustfmt_diff::*; +use rustfmt::*; const DIFF_CONTEXT_SIZE: usize = 3; const CONFIGURATIONS_FILE_NAME: &str = "Configurations.md"; diff --git a/tests/source/imports.rs b/tests/source/imports.rs index 73d1419f47d..cbe5f4c7bb2 100644 --- a/tests/source/imports.rs +++ b/tests/source/imports.rs @@ -21,6 +21,7 @@ Foo, Bar /* comment */}; use Foo::{Bar, Baz}; pub use syntax::ast::{Expr_, Expr, ExprAssign, ExprCall, ExprMethodCall, ExprPath}; + use syntax::some::{}; use self; diff --git a/tests/target/import-fencepost-length.rs b/tests/target/import-fencepost-length.rs index 9d247aaf6df..e4f885c09b1 100644 --- a/tests/target/import-fencepost-length.rs +++ b/tests/target/import-fencepost-length.rs @@ -1,4 +1,4 @@ +use aaaaaaaaaaaaaaa::bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; use aaaaaaaaaaaaaaa::{bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccccccccccccccccc, dddddddd}; use aaaaaaaaaaaaaaa::{bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccccccccccccccccc, ddddddddd}; -use aaaaaaaaaaaaaaa::bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; diff --git a/tests/target/imports-reorder-lines-and-items.rs b/tests/target/imports-reorder-lines-and-items.rs index f395710b186..e31819be2c0 100644 --- a/tests/target/imports-reorder-lines-and-items.rs +++ b/tests/target/imports-reorder-lines-and-items.rs @@ -2,9 +2,9 @@ // rustfmt-reorder_imported_names: true use std::cmp::{a, b, c, d}; -use std::ddd::{a, b, c as g, d as p}; use std::ddd::aaa; -// This comment should stay with `use std::ddd:bbb;` -use std::ddd::bbb; +use std::ddd::{a, b, c as g, d as p}; /// This comment should stay with `use std::str;` use std::str; +// This comment should stay with `use std::ddd:bbb;` +use std::ddd::bbb; diff --git a/tests/target/imports-reorder-lines.rs b/tests/target/imports-reorder-lines.rs index 3695d6b4913..2aeb8fadd2c 100644 --- a/tests/target/imports-reorder-lines.rs +++ b/tests/target/imports-reorder-lines.rs @@ -2,29 +2,29 @@ use std::cmp::{a, b, c, d}; use std::cmp::{b, e, f, g}; +use std::ddd::aaa; +use std::str; // This comment should stay with `use std::ddd;` use std::ddd; -use std::ddd::aaa; use std::ddd::bbb; -use std::str; mod test {} use aaa; -use aaa::*; use aaa::bbb; +use aaa::*; mod test {} // If item names are equal, order by rename -use test::{a as aa, c}; use test::{a as bb, b}; +use test::{a as aa, c}; mod test {} // If item names are equal, order by rename - no rename comes before a rename -use test::{a, c}; use test::{a as bb, b}; +use test::{a, c}; mod test {} // `self` always comes first diff --git a/tests/target/imports.rs b/tests/target/imports.rs index 5845669e868..86dbfc08020 100644 --- a/tests/target/imports.rs +++ b/tests/target/imports.rs @@ -19,10 +19,10 @@ use test::{/* A */ self /* B */, Other /* C */}; -use {Bar /* comment */, /* Pre-comment! */ Foo}; use Foo::{Bar, Baz}; use syntax; pub use syntax::ast::{Expr, ExprAssign, ExprCall, ExprMethodCall, ExprPath, Expr_}; +use {Bar /* comment */, /* Pre-comment! */ Foo}; use self; use std::io; @@ -54,8 +54,8 @@ fn test() { use foo::{baz, qux as bar}; // With absolute paths -use foo; use Foo; +use foo; use foo::Bar; use foo::{Bar, Baz}; use {Bar, Baz}; diff --git a/tests/target/issue-1124.rs b/tests/target/issue-1124.rs index d34870b2a28..ca77a761fb4 100644 --- a/tests/target/issue-1124.rs +++ b/tests/target/issue-1124.rs @@ -14,7 +14,9 @@ mod a { use d; } +use z; + +use y; + use a; use x; -use y; -use z; diff --git a/tests/target/issue-2256.rs b/tests/target/issue-2256.rs index 4b546223f94..d4e594515b3 100644 --- a/tests/target/issue-2256.rs +++ b/tests/target/issue-2256.rs @@ -2,6 +2,7 @@ use std::borrow::Cow; /* comment */ + /* comment */ /* comment */