Skip to content

Commit c9d047c

Browse files
committed
format code and tests
1 parent b5aba78 commit c9d047c

File tree

14 files changed

+23
-27
lines changed

14 files changed

+23
-27
lines changed

bootstrap.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
cargo build --release
88

99
target/release/rustfmt --write-mode=overwrite src/lib.rs
10-
target/release/rustfmt --write-mode=overwrite src/bin/rustfmt.rs
11-
target/release/rustfmt --write-mode=overwrite src/bin/cargo-fmt.rs
12-
target/release/rustfmt --write-mode=overwrite tests/system.rs
10+
target/release/rustfmt --write-mode=overwrite src/bin/main.rs
11+
target/release/rustfmt --write-mode=overwrite src/cargo-fmt/main.rs
1312

1413
for filename in tests/target/*.rs; do
1514
if ! grep -q "rustfmt-" "$filename"; then

src/bin/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ use std::str::FromStr;
2222

2323
use getopts::{Matches, Options};
2424

25+
use rustfmt::{run, FileName, Input, Summary};
2526
use rustfmt::config::{get_toml_path, Color, Config, WriteMode};
2627
use rustfmt::config::file_lines::FileLines;
27-
use rustfmt::{run, FileName, Input, Summary};
2828

2929
type FmtError = Box<error::Error + Send + Sync>;
3030
type FmtResult<T> = std::result::Result<T, FmtError>;

src/codemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//! This includes extension traits and methods for looking up spans and line ranges for AST nodes.
1313
1414
use config::file_lines::LineRange;
15-
use visitor::SnippetProvider;
1615
use syntax::codemap::{BytePos, CodeMap, Span};
16+
use visitor::SnippetProvider;
1717

1818
use comment::FindUncommented;
1919

src/config/license.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use std::io;
21
use std::fmt;
32
use std::fs::File;
3+
use std::io;
44
use std::io::Read;
55

66
use regex;

src/config/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ mod config_type;
2323
mod options;
2424

2525
pub mod file_lines;
26+
pub mod license;
2627
pub mod lists;
2728
pub mod summary;
28-
pub mod license;
2929

3030
use config::config_type::ConfigType;
3131
use config::file_lines::FileLines;
@@ -69,7 +69,7 @@ create_config! {
6969

7070
// Ordering
7171
reorder_extern_crates: bool, true, false, "Reorder extern crate statements alphabetically";
72-
reorder_extern_crates_in_group: bool, true, false, "Reorder extern crate statements in group";
72+
reorder_extern_crates_in_group: bool, false, false, "Reorder extern crate statements in group";
7373
reorder_imports: bool, true, false, "Reorder import statements alphabetically";
7474
reorder_imports_in_group: bool, true, false, "Reorder import statements in group";
7575
reorder_imported_names: bool, true, false,

src/config/summary.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::time::{Duration, Instant};
1211
use std::default::Default;
12+
use std::time::{Duration, Instant};
1313

1414
#[must_use]
1515
#[derive(Debug, Default, Clone, Copy)]

src/items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ use config::{BraceStyle, Config, Density, IndentStyle};
2626
use expr::{format_expr, is_empty_block, is_simple_block_stmt, rewrite_assign_rhs,
2727
rewrite_assign_rhs_with, ExprType, RhsTactics};
2828
use lists::{definitive_tactic, itemize_list, write_list, ListFormatting, ListItem, Separator};
29-
use rewrite::{Rewrite, RewriteContext};
3029
use overflow;
30+
use rewrite::{Rewrite, RewriteContext};
3131
use shape::{Indent, Shape};
3232
use spanned::Spanned;
3333
use types::TraitTyParamBounds;

src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,8 +962,8 @@ fn format_lazy_static(context: &RewriteContext, shape: Shape, ts: &TokenStream)
962962
#[cfg(test)]
963963
mod test {
964964
use super::*;
965-
use syntax::parse::{parse_stream_from_source_str, ParseSess};
966965
use syntax::codemap::{FileName, FilePathMapping};
966+
use syntax::parse::{parse_stream_from_source_str, ParseSess};
967967

968968
fn format_macro_args_str(s: &str) -> String {
969969
let input = parse_stream_from_source_str(

src/overflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ use syntax::codemap::Span;
1717

1818
use closures;
1919
use codemap::SpanUtils;
20+
use expr::{is_nested_call, maybe_get_args_offset, ToExpr};
2021
use lists::{definitive_tactic, itemize_list, write_list, ListFormatting, ListItem, Separator};
2122
use rewrite::{Rewrite, RewriteContext};
22-
use expr::{is_nested_call, maybe_get_args_offset, ToExpr};
2323
use shape::Shape;
2424
use spanned::Spanned;
2525
use utils::{count_newlines, extra_offset, first_line_width, last_line_width, mk_sp, paren_overhead};

src/rustfmt_diff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use config::Color;
1212
use diff;
1313
use std::collections::VecDeque;
1414
use std::io;
15-
use term;
1615
use std::io::Write;
16+
use term;
1717
use utils::use_colored_tty;
1818

1919
#[derive(Debug, PartialEq)]

tests/target/extern.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
// rustfmt-normalize_comments: true
22

3-
extern crate foo;
4-
extern crate foo as bar;
5-
3+
extern crate bar;
64
extern crate chrono;
75
extern crate dotenv;
8-
extern crate futures;
9-
10-
extern crate bar;
116
extern crate foo;
12-
13-
// #2315
7+
extern crate foo;
8+
extern crate foo as bar;
9+
extern crate futures;
1410
extern crate proc_macro;
11+
// #2315
1512
extern crate proc_macro2;
1613

1714
extern "C" {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use aaaaaaaaaaaaaaa::bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
21
use aaaaaaaaaaaaaaa::{bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccccccccccccccccc, dddddddd};
32
use aaaaaaaaaaaaaaa::{bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccccccccccccccccc,
43
ddddddddd};
4+
use aaaaaaaaaaaaaaa::bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

tests/target/imports.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
// Imports.
55

66
// Long import.
7-
use syntax::ast::{ItemDefaultImpl, ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic};
8-
use exceedingly::looooooooooooooooooooooooooooooooooooooooooooooooooooooooooong::import::path::{ItemA,
9-
ItemB};
107
use exceedingly::loooooooooooooooooooooooooooooooooooooooooooooooooooooooong::import::path::{ItemA,
118
ItemB};
9+
use exceedingly::looooooooooooooooooooooooooooooooooooooooooooooooooooooooooong::import::path::{ItemA,
10+
ItemB};
11+
use syntax::ast::{ItemDefaultImpl, ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic};
1212

1313
use list::{// Another item
1414
AnotherItem, // Another Comment
@@ -19,9 +19,9 @@ use list::{// Another item
1919

2020
use test::{/* A */ self /* B */, Other /* C */};
2121

22-
use syntax;
2322
use {Bar /* comment */, /* Pre-comment! */ Foo};
2423
use Foo::{Bar, Baz};
24+
use syntax;
2525
pub use syntax::ast::{Expr, ExprAssign, ExprCall, ExprMethodCall, ExprPath, Expr_};
2626

2727
use self;

tests/target/skip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn skip_on_statements() {
5959

6060
// Item
6161
#[cfg_attr(rustfmt, rustfmt_skip)]
62-
use foobar ;
62+
use foobar;
6363

6464
// Mac
6565
#[cfg_attr(rustfmt, rustfmt_skip)]

0 commit comments

Comments
 (0)