format code and tests

This commit is contained in:
Nick Cameron 2018-03-12 17:24:04 +13:00
parent 164cf7d6c9
commit a76d9b529a
13 changed files with 22 additions and 26 deletions

@ -7,9 +7,8 @@
cargo build --release
target/release/rustfmt --write-mode=overwrite src/lib.rs
target/release/rustfmt --write-mode=overwrite src/bin/rustfmt.rs
target/release/rustfmt --write-mode=overwrite src/bin/cargo-fmt.rs
target/release/rustfmt --write-mode=overwrite tests/system.rs
target/release/rustfmt --write-mode=overwrite src/bin/main.rs
target/release/rustfmt --write-mode=overwrite src/cargo-fmt/main.rs
for filename in tests/target/*.rs; do
if ! grep -q "rustfmt-" "$filename"; then

@ -22,9 +22,9 @@ use std::str::FromStr;
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::{run, FileName, Input, Summary};
type FmtError = Box<error::Error + Send + Sync>;
type FmtResult<T> = std::result::Result<T, FmtError>;

@ -12,8 +12,8 @@
//! This includes extension traits and methods for looking up spans and line ranges for AST nodes.
use config::file_lines::LineRange;
use visitor::SnippetProvider;
use syntax::codemap::{BytePos, CodeMap, Span};
use visitor::SnippetProvider;
use comment::FindUncommented;

@ -1,6 +1,6 @@
use std::io;
use std::fmt;
use std::fs::File;
use std::io;
use std::io::Read;
use regex;

@ -23,9 +23,9 @@ mod config_type;
mod options;
pub mod file_lines;
pub mod license;
pub mod lists;
pub mod summary;
pub mod license;
use config::config_type::ConfigType;
use config::file_lines::FileLines;
@ -69,7 +69,7 @@ create_config! {
// Ordering
reorder_extern_crates: bool, true, false, "Reorder extern crate statements alphabetically";
reorder_extern_crates_in_group: bool, true, false, "Reorder extern crate statements in group";
reorder_extern_crates_in_group: bool, false, false, "Reorder extern crate statements in group";
reorder_imports: bool, true, false, "Reorder import statements alphabetically";
reorder_imports_in_group: bool, true, false, "Reorder import statements in group";
reorder_imported_names: bool, true, false,

@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::time::{Duration, Instant};
use std::default::Default;
use std::time::{Duration, Instant};
#[must_use]
#[derive(Debug, Default, Clone, Copy)]

@ -26,8 +26,8 @@ use config::{BraceStyle, Config, Density, IndentStyle};
use expr::{format_expr, is_empty_block, is_simple_block_stmt, rewrite_assign_rhs,
rewrite_assign_rhs_with, ExprType, RhsTactics};
use lists::{definitive_tactic, itemize_list, write_list, ListFormatting, ListItem, Separator};
use rewrite::{Rewrite, RewriteContext};
use overflow;
use rewrite::{Rewrite, RewriteContext};
use shape::{Indent, Shape};
use spanned::Spanned;
use types::TraitTyParamBounds;

@ -17,9 +17,9 @@ use syntax::codemap::Span;
use closures;
use codemap::SpanUtils;
use expr::{is_nested_call, maybe_get_args_offset, ToExpr};
use lists::{definitive_tactic, itemize_list, write_list, ListFormatting, ListItem, Separator};
use rewrite::{Rewrite, RewriteContext};
use expr::{is_nested_call, maybe_get_args_offset, ToExpr};
use shape::Shape;
use spanned::Spanned;
use utils::{count_newlines, extra_offset, first_line_width, last_line_width, mk_sp, paren_overhead};

@ -12,8 +12,8 @@ use config::Color;
use diff;
use std::collections::VecDeque;
use std::io;
use term;
use std::io::Write;
use term;
use utils::use_colored_tty;
#[derive(Debug, PartialEq)]

@ -1,17 +1,14 @@
// rustfmt-normalize_comments: true
extern crate foo;
extern crate foo as bar;
extern crate bar;
extern crate chrono;
extern crate dotenv;
extern crate futures;
extern crate bar;
extern crate foo;
// #2315
extern crate foo;
extern crate foo as bar;
extern crate futures;
extern crate proc_macro;
// #2315
extern crate proc_macro2;
extern "C" {

@ -1,4 +1,4 @@
use aaaaaaaaaaaaaaa::bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
use aaaaaaaaaaaaaaa::{bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccccccccccccccccc, dddddddd};
use aaaaaaaaaaaaaaa::{bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccccccccccccccccc,
ddddddddd};
use aaaaaaaaaaaaaaa::bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

@ -4,11 +4,11 @@
// Imports.
// Long import.
use syntax::ast::{ItemDefaultImpl, ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic};
use exceedingly::looooooooooooooooooooooooooooooooooooooooooooooooooooooooooong::import::path::{ItemA,
ItemB};
use exceedingly::loooooooooooooooooooooooooooooooooooooooooooooooooooooooong::import::path::{ItemA,
ItemB};
use exceedingly::looooooooooooooooooooooooooooooooooooooooooooooooooooooooooong::import::path::{ItemA,
ItemB};
use syntax::ast::{ItemDefaultImpl, ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic};
use list::{// Another item
AnotherItem, // Another Comment
@ -19,9 +19,9 @@ use list::{// Another item
use test::{/* A */ self /* B */, Other /* C */};
use syntax;
use {Bar /* comment */, /* Pre-comment! */ Foo};
use Foo::{Bar, Baz};
use syntax;
pub use syntax::ast::{Expr, ExprAssign, ExprCall, ExprMethodCall, ExprPath, Expr_};
use self;

@ -59,7 +59,7 @@ fn skip_on_statements() {
// Item
#[cfg_attr(rustfmt, rustfmt_skip)]
use foobar ;
use foobar;
// Mac
#[cfg_attr(rustfmt, rustfmt_skip)]