Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Mar 19, 2018
1 parent 4cfffbd commit 50c95a0
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 26 deletions.
9 changes: 4 additions & 5 deletions Configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down
6 changes: 3 additions & 3 deletions src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<error::Error + Send + Sync>;
type FmtResult<T> = std::result::Result<T, FmtError>;
Expand Down
2 changes: 1 addition & 1 deletion src/chains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> {
debug!("rewrite_chain {:?}", shape);
Expand Down
2 changes: 1 addition & 1 deletion src/closures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion src/config/file_lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/format-diff/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/rustfmt_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
9 changes: 5 additions & 4 deletions tests/target/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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};

0 comments on commit 50c95a0

Please sign in to comment.