From 50c95a074a051f9ea2e9a474289a41081bdf4e0f Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Wed, 14 Mar 2018 20:43:01 +1300 Subject: [PATCH] cargo fmt --- Configurations.md | 9 ++++----- src/bin/main.rs | 6 +++--- src/chains.rs | 2 +- src/closures.rs | 2 +- src/config/file_lines.rs | 2 +- src/config/mod.rs | 2 +- src/expr.rs | 2 +- src/format-diff/main.rs | 2 +- src/items.rs | 2 +- src/lib.rs | 6 +++--- src/macros.rs | 2 +- src/rustfmt_diff.rs | 2 +- src/utils.rs | 2 +- src/visitor.rs | 2 +- tests/target/imports.rs | 9 +++++---- 15 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Configurations.md b/Configurations.md index 2b9cd13ad33..975cb890ed7 100644 --- a/Configurations.md +++ b/Configurations.md @@ -1300,13 +1300,12 @@ Reorder import statements in group #### `false` (default): ```rust -use std::mem; -use std::io; - -use lorem; -use ipsum; use dolor; +use ipsum; +use lorem; use sit; +use std::io; +use std::mem; ``` #### `true`: diff --git a/src/bin/main.rs b/src/bin/main.rs index 914b2cee1af..b59e47930e0 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -14,17 +14,17 @@ extern crate env_logger; extern crate getopts; extern crate rustfmt_nightly as rustfmt; -use std::{env, error}; use std::fs::File; use std::io::{self, Read, Write}; use std::path::{Path, PathBuf}; use std::str::FromStr; +use std::{env, error}; use getopts::{Matches, Options}; -use rustfmt::{run, FileName, Input, Summary}; -use rustfmt::config::{get_toml_path, Color, Config, WriteMode}; use rustfmt::config::file_lines::FileLines; +use rustfmt::config::{get_toml_path, Color, Config, WriteMode}; +use rustfmt::{run, FileName, Input, Summary}; type FmtError = Box; type FmtResult = std::result::Result; diff --git a/src/chains.rs b/src/chains.rs index e26f4966628..d798981415e 100644 --- a/src/chains.rs +++ b/src/chains.rs @@ -77,8 +77,8 @@ use std::borrow::Cow; use std::cmp::min; use std::iter; -use syntax::{ast, ptr}; use syntax::codemap::Span; +use syntax::{ast, ptr}; pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -> Option { debug!("rewrite_chain {:?}", shape); diff --git a/src/closures.rs b/src/closures.rs index 65052d766eb..2ec31afa391 100644 --- a/src/closures.rs +++ b/src/closures.rs @@ -9,9 +9,9 @@ // except according to those terms. use config::lists::*; -use syntax::{ast, ptr}; use syntax::codemap::Span; use syntax::parse::classify; +use syntax::{ast, ptr}; use codemap::SpanUtils; use expr::{block_contains_comment, is_simple_block, is_unsafe_block, rewrite_cond, ToExpr}; diff --git a/src/config/file_lines.rs b/src/config/file_lines.rs index 714f33c03dc..cf3f827c00d 100644 --- a/src/config/file_lines.rs +++ b/src/config/file_lines.rs @@ -10,9 +10,9 @@ //! This module contains types and functions to support formatting specific line ranges. -use std::{cmp, iter, str}; use std::collections::HashMap; use std::rc::Rc; +use std::{cmp, iter, str}; use serde::de::{Deserialize, Deserializer}; use serde_json as json; diff --git a/src/config/mod.rs b/src/config/mod.rs index 056cd26151f..b28592e613b 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -8,12 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::{env, fs}; use std::cell::Cell; use std::default::Default; use std::fs::File; use std::io::{Error, ErrorKind, Read}; use std::path::{Path, PathBuf}; +use std::{env, fs}; use regex::Regex; diff --git a/src/expr.rs b/src/expr.rs index e144c8307b6..d364da20128 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -13,8 +13,8 @@ use std::cmp::min; use std::iter::repeat; use config::lists::*; -use syntax::{ast, ptr}; use syntax::codemap::{BytePos, CodeMap, Span}; +use syntax::{ast, ptr}; use chains::rewrite_chain; use closures; diff --git a/src/format-diff/main.rs b/src/format-diff/main.rs index 6633da208e8..c871395f72a 100644 --- a/src/format-diff/main.rs +++ b/src/format-diff/main.rs @@ -23,10 +23,10 @@ extern crate regex; extern crate serde_derive; extern crate serde_json as json; -use std::{env, fmt, process}; use std::collections::HashSet; use std::error::Error; use std::io::{self, BufRead}; +use std::{env, fmt, process}; use regex::Regex; diff --git a/src/items.rs b/src/items.rs index 273e5b36d6f..2e0e869d12a 100644 --- a/src/items.rs +++ b/src/items.rs @@ -15,9 +15,9 @@ use std::cmp::min; use config::lists::*; use regex::Regex; -use syntax::{abi, ast, ptr, symbol}; use syntax::codemap::{self, BytePos, Span}; use syntax::visit; +use syntax::{abi, ast, ptr, symbol}; use codemap::{LineRangeUtils, SpanUtils}; use comment::{combine_strs_with_missing_comments, contains_comment, recover_comment_removed, diff --git a/src/lib.rs b/src/lib.rs index eff414b5708..c080f1396cb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,11 +38,11 @@ use std::path::PathBuf; use std::rc::Rc; use std::time::Duration; -use syntax::errors::{DiagnosticBuilder, Handler}; -use syntax::errors::emitter::{ColorConfig, EmitterWriter}; use syntax::ast; -use syntax::codemap::{CodeMap, FilePathMapping}; pub use syntax::codemap::FileName; +use syntax::codemap::{CodeMap, FilePathMapping}; +use syntax::errors::{DiagnosticBuilder, Handler}; +use syntax::errors::emitter::{ColorConfig, EmitterWriter}; use syntax::parse::{self, ParseSess}; use checkstyle::{output_footer, output_header}; diff --git a/src/macros.rs b/src/macros.rs index 784e6c5798b..ec1ca29d173 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -22,7 +22,6 @@ use std::collections::HashMap; use config::lists::*; -use syntax::{ast, ptr}; use syntax::codemap::{BytePos, Span}; use syntax::parse::new_parser_from_tts; use syntax::parse::parser::Parser; @@ -31,6 +30,7 @@ use syntax::print::pprust; use syntax::symbol; use syntax::tokenstream::{Cursor, ThinTokenStream, TokenStream, TokenTree}; use syntax::util::ThinVec; +use syntax::{ast, ptr}; use codemap::SpanUtils; use comment::{contains_comment, remove_trailing_white_spaces, CharClasses, FindUncommented, diff --git a/src/rustfmt_diff.rs b/src/rustfmt_diff.rs index ca847656562..db72a775f41 100644 --- a/src/rustfmt_diff.rs +++ b/src/rustfmt_diff.rs @@ -211,8 +211,8 @@ where #[cfg(test)] mod test { - use super::{make_diff, Mismatch}; use super::DiffLine::*; + use super::{make_diff, Mismatch}; #[test] fn diff_simple() { diff --git a/src/utils.rs b/src/utils.rs index f6d2ff23c34..d1d526efe36 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -10,10 +10,10 @@ use std::borrow::Cow; -use syntax::{abi, ptr}; use syntax::ast::{self, Attribute, CrateSugar, MetaItem, MetaItemKind, NestedMetaItem, NestedMetaItemKind, Path, Visibility, VisibilityKind}; use syntax::codemap::{BytePos, Span, NO_EXPANSION}; +use syntax::{abi, ptr}; use config::Color; use rewrite::RewriteContext; diff --git a/src/visitor.rs b/src/visitor.rs index 81f35d787ab..54a85062d43 100644 --- a/src/visitor.rs +++ b/src/visitor.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use syntax::{ast, visit}; use syntax::attr::HasAttrs; use syntax::codemap::{self, BytePos, CodeMap, Pos, Span}; use syntax::parse::ParseSess; +use syntax::{ast, visit}; use attr::*; use codemap::{LineRangeUtils, SpanUtils}; diff --git a/tests/target/imports.rs b/tests/target/imports.rs index 34573b48937..5845669e868 100644 --- a/tests/target/imports.rs +++ b/tests/target/imports.rs @@ -43,21 +43,21 @@ fn test() { } // Simple imports -use foo::bar::baz; use bar::quux as kaas; use foo; +use foo::bar::baz; // With aliases. -use foo::{self as bar, baz}; use foo as bar; use foo::qux as bar; +use foo::{self as bar, baz}; use foo::{baz, qux as bar}; // With absolute paths use foo; +use Foo; use foo::Bar; use foo::{Bar, Baz}; -use Foo; use {Bar, Baz}; // Root globs @@ -83,6 +83,7 @@ use fooo::{bar, x, y, z, bar::*}; // nested imports with a single sub-tree. -use a::b::c::*; use a::b::c::d; +use a::b::c::*; + use a::b::c::{xxx, yyy, zzz};