diff --git a/src/bin/cargo-fmt.rs b/src/bin/cargo-fmt.rs index 3f7d11c0a97d..b07a40804ddc 100644 --- a/src/bin/cargo-fmt.rs +++ b/src/bin/cargo-fmt.rs @@ -24,10 +24,9 @@ use std::str; use std::collections::HashSet; use std::iter::FromIterator; +use getopts::{Matches, Options}; use json::Value; -use getopts::{Options, Matches}; - fn main() { let exit_status = execute(); std::io::stdout().flush().unwrap(); diff --git a/src/bin/rustfmt.rs b/src/bin/rustfmt.rs index d2f2f3d761b7..f0846b43ea8c 100644 --- a/src/bin/rustfmt.rs +++ b/src/bin/rustfmt.rs @@ -17,10 +17,6 @@ extern crate toml; extern crate env_logger; extern crate getopts; -use rustfmt::{run, Input, Summary}; -use rustfmt::file_lines::FileLines; -use rustfmt::config::{Config, WriteMode, get_toml_path}; - use std::{env, error}; use std::fs::File; use std::io::{self, Read, Write}; @@ -29,6 +25,10 @@ use std::str::FromStr; use getopts::{Matches, Options}; +use rustfmt::{run, Input, Summary}; +use rustfmt::file_lines::FileLines; +use rustfmt::config::{get_toml_path, Config, WriteMode}; + type FmtError = Box; type FmtResult = std::result::Result; diff --git a/src/chains.rs b/src/chains.rs index 1660e113dcd2..fdf0a80709b3 100644 --- a/src/chains.rs +++ b/src/chains.rs @@ -77,11 +77,11 @@ /// ``` use Shape; -use rewrite::{Rewrite, RewriteContext}; -use utils::{wrap_str, first_line_width, last_line_width, mk_sp, last_line_extendable}; -use expr::rewrite_call; use config::IndentStyle; +use expr::rewrite_call; use macros::convert_try_mac; +use rewrite::{Rewrite, RewriteContext}; +use utils::{first_line_width, last_line_extendable, last_line_width, mk_sp, wrap_str}; use std::cmp::min; use std::iter; diff --git a/src/checkstyle.rs b/src/checkstyle.rs index 7b7ab2e1b2de..0934ed3f7192 100644 --- a/src/checkstyle.rs +++ b/src/checkstyle.rs @@ -7,10 +7,11 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -use rustfmt_diff::{Mismatch, DiffLine}; -use std::io::{self, Write}; -use config::WriteMode; +use std::io::{self, Write}; + +use config::WriteMode; +use rustfmt_diff::{DiffLine, Mismatch}; pub fn output_header(out: &mut T, mode: WriteMode) -> Result<(), io::Error> where diff --git a/src/comment.rs b/src/comment.rs index df97c2bfef3e..b3fd171b86f1 100644 --- a/src/comment.rs +++ b/src/comment.rs @@ -17,7 +17,7 @@ use syntax::codemap::Span; use {Indent, Shape}; use config::Config; use rewrite::RewriteContext; -use string::{StringFormat, rewrite_string}; +use string::{rewrite_string, StringFormat}; use utils::wrap_str; fn is_custom_comment(comment: &str) -> bool { @@ -809,8 +809,8 @@ fn remove_comment_header(comment: &str) -> &str { #[cfg(test)] mod test { - use super::{CharClasses, CodeCharKind, FullCodeCharKind, contains_comment, rewrite_comment, - FindUncommented, CommentCodeSlices}; + use super::{contains_comment, rewrite_comment, CharClasses, CodeCharKind, CommentCodeSlices, + FindUncommented, FullCodeCharKind}; use {Indent, Shape}; #[test] diff --git a/src/config.rs b/src/config.rs index 1965675a83ee..995e6164cf45 100644 --- a/src/config.rs +++ b/src/config.rs @@ -10,15 +10,14 @@ extern crate toml; +use std::{env, fs}; use std::cell::Cell; -use std::fs; use std::fs::File; -use std::env; use std::io::{Error, ErrorKind, Read}; use std::path::{Path, PathBuf}; use file_lines::FileLines; -use lists::{SeparatorTactic, ListTactic}; +use lists::{ListTactic, SeparatorTactic}; macro_rules! configuration_option_enum{ ($e:ident: $( $x:ident ),+ $(,)*) => { diff --git a/src/expr.rs b/src/expr.rs index e11625218597..88f56cfa25c0 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -8,34 +8,34 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::cmp::{Ordering, min}; -use std::iter::ExactSizeIterator; +use std::cmp::{min, Ordering}; use std::fmt::Write; - -use {Indent, Shape, Spanned}; -use codemap::SpanUtils; -use rewrite::{Rewrite, RewriteContext}; -use lists::{write_list, itemize_list, ListFormatting, SeparatorTactic, ListTactic, - DefinitiveListTactic, definitive_tactic, ListItem, struct_lit_shape, - struct_lit_tactic, shape_for_tactic, struct_lit_formatting}; -use string::{StringFormat, rewrite_string}; -use utils::{extra_offset, last_line_width, wrap_str, binary_search, first_line_width, - semicolon_for_stmt, trimmed_last_line_width, left_most_sub_expr, stmt_expr, - colon_spaces, contains_skip, mk_sp, last_line_extendable, paren_overhead}; -use visitor::FmtVisitor; -use config::{Config, IndentStyle, MultilineStyle, ControlBraceStyle, Style}; -use comment::{FindUncommented, rewrite_comment, contains_comment, recover_comment_removed}; -use types::{rewrite_path, PathContext, can_be_overflowed_type}; -use items::{span_lo_for_arg, span_hi_for_arg}; -use chains::rewrite_chain; -use macros::{rewrite_macro, MacroPosition}; -use patterns::{TuplePatField, can_be_overflowed_pat}; -use vertical::rewrite_with_alignment; +use std::iter::ExactSizeIterator; use syntax::{ast, ptr}; -use syntax::codemap::{CodeMap, Span, BytePos}; +use syntax::codemap::{BytePos, CodeMap, Span}; use syntax::parse::classify; +use {Indent, Shape, Spanned}; +use chains::rewrite_chain; +use codemap::SpanUtils; +use comment::{contains_comment, recover_comment_removed, rewrite_comment, FindUncommented}; +use config::{Config, ControlBraceStyle, IndentStyle, MultilineStyle, Style}; +use items::{span_hi_for_arg, span_lo_for_arg}; +use lists::{definitive_tactic, itemize_list, shape_for_tactic, struct_lit_formatting, + struct_lit_shape, struct_lit_tactic, write_list, DefinitiveListTactic, ListFormatting, + ListItem, ListTactic, SeparatorTactic}; +use macros::{rewrite_macro, MacroPosition}; +use patterns::{can_be_overflowed_pat, TuplePatField}; +use rewrite::{Rewrite, RewriteContext}; +use string::{rewrite_string, StringFormat}; +use types::{can_be_overflowed_type, rewrite_path, PathContext}; +use utils::{binary_search, colon_spaces, contains_skip, extra_offset, first_line_width, + last_line_extendable, last_line_width, left_most_sub_expr, mk_sp, paren_overhead, + semicolon_for_stmt, stmt_expr, trimmed_last_line_width, wrap_str}; +use vertical::rewrite_with_alignment; +use visitor::FmtVisitor; + impl Rewrite for ast::Expr { fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option { format_expr(self, ExprType::SubExpression, context, shape) diff --git a/src/filemap.rs b/src/filemap.rs index e9779edfe5cb..ee0a21b39b13 100644 --- a/src/filemap.rs +++ b/src/filemap.rs @@ -11,14 +11,14 @@ // TODO: add tests +use std::fs::{self, File}; +use std::io::{self, BufWriter, Read, Write}; + use strings::string_buffer::StringBuffer; -use std::fs::{self, File}; -use std::io::{self, Write, Read, BufWriter}; - -use config::{NewlineStyle, Config, WriteMode}; +use checkstyle::{output_checkstyle_file, output_footer, output_header}; +use config::{Config, NewlineStyle, WriteMode}; use rustfmt_diff::{make_diff, print_diff, Mismatch}; -use checkstyle::{output_header, output_footer, output_checkstyle_file}; // A map of the files of a crate, with their new content pub type FileMap = Vec; diff --git a/src/imports.rs b/src/imports.rs index 8c38f37f2630..a43b281f3cfa 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -8,17 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use Shape; -use utils; -use syntax::codemap::{BytePos, Span}; -use codemap::SpanUtils; -use lists::{write_list, itemize_list, ListItem, ListFormatting, SeparatorTactic, definitive_tactic}; -use types::{rewrite_path, PathContext}; -use rewrite::{Rewrite, RewriteContext}; -use visitor::FmtVisitor; use std::cmp::{self, Ordering}; use syntax::{ast, ptr}; +use syntax::codemap::{BytePos, Span}; + +use Shape; +use codemap::SpanUtils; +use lists::{definitive_tactic, itemize_list, write_list, ListFormatting, ListItem, SeparatorTactic}; +use rewrite::{Rewrite, RewriteContext}; +use types::{rewrite_path, PathContext}; +use utils; +use visitor::FmtVisitor; fn path_of(a: &ast::ViewPath_) -> &ast::Path { match *a { diff --git a/src/issues.rs b/src/issues.rs index 432fb797a6e4..b81f902d59f3 100644 --- a/src/issues.rs +++ b/src/issues.rs @@ -13,6 +13,7 @@ // associated issue number. use std::fmt; + pub use config::ReportTactic; const TO_DO_CHARS: &'static [char] = &['T', 'O', 'D', 'O']; diff --git a/src/items.rs b/src/items.rs index 2f3018a25524..eb15e95fabb3 100644 --- a/src/items.rs +++ b/src/items.rs @@ -10,25 +10,25 @@ // Formatting top-level items - functions, structs, enums, traits, impls. +use syntax::{abi, ast, ptr, symbol}; +use syntax::ast::ImplItem; +use syntax::codemap::{BytePos, Span}; + use {Indent, Shape, Spanned}; use codemap::SpanUtils; -use utils::{format_mutability, format_visibility, contains_skip, end_typaram, wrap_str, - last_line_width, format_unsafety, trim_newlines, stmt_expr, semicolon_for_expr, - trimmed_last_line_width, colon_spaces, mk_sp}; -use lists::{write_list, itemize_list, ListItem, ListFormatting, SeparatorTactic, - DefinitiveListTactic, ListTactic, definitive_tactic}; +use comment::{contains_comment, recover_comment_removed, rewrite_comment, FindUncommented}; +use config::{BraceStyle, Config, Density, IndentStyle, ReturnIndent, Style}; use expr::{format_expr, is_empty_block, is_simple_block_stmt, rewrite_assign_rhs, rewrite_call_inner, ExprType}; -use comment::{FindUncommented, contains_comment, rewrite_comment, recover_comment_removed}; -use visitor::FmtVisitor; +use lists::{definitive_tactic, itemize_list, write_list, DefinitiveListTactic, ListFormatting, + ListItem, ListTactic, SeparatorTactic}; use rewrite::{Rewrite, RewriteContext}; -use config::{Config, IndentStyle, Density, ReturnIndent, BraceStyle, Style}; use types::join_bounds; +use utils::{colon_spaces, contains_skip, end_typaram, format_mutability, format_unsafety, + format_visibility, last_line_width, mk_sp, semicolon_for_expr, stmt_expr, + trim_newlines, trimmed_last_line_width, wrap_str}; use vertical::rewrite_with_alignment; - -use syntax::{ast, abi, ptr, symbol}; -use syntax::codemap::{Span, BytePos}; -use syntax::ast::ImplItem; +use visitor::FmtVisitor; fn type_annotation_separator(config: &Config) -> &str { colon_spaces( diff --git a/src/lib.rs b/src/lib.rs index 030d18c3000f..088f0950f104 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,27 +28,26 @@ extern crate regex; extern crate diff; extern crate term; -use errors::{Handler, DiagnosticBuilder}; -use errors::emitter::{ColorConfig, EmitterWriter}; -use syntax::ast; -use syntax::codemap::{CodeMap, Span, FilePathMapping}; -use syntax::parse::{self, ParseSess}; - -use strings::string_buffer::StringBuffer; - +use std::collections::HashMap; +use std::fmt; use std::io::{self, stdout, Write}; use std::ops::{Add, Sub}; use std::path::{Path, PathBuf}; use std::rc::Rc; -use std::collections::HashMap; -use std::fmt; -use issues::{BadIssueSeeker, Issue}; -use filemap::FileMap; -use visitor::FmtVisitor; +use errors::{DiagnosticBuilder, Handler}; +use errors::emitter::{ColorConfig, EmitterWriter}; +use strings::string_buffer::StringBuffer; +use syntax::ast; +use syntax::codemap::{CodeMap, FilePathMapping, Span}; +use syntax::parse::{self, ParseSess}; + +use checkstyle::{output_footer, output_header}; use config::Config; -use checkstyle::{output_header, output_footer}; +use filemap::FileMap; +use issues::{BadIssueSeeker, Issue}; use utils::mk_sp; +use visitor::FmtVisitor; pub use self::summary::Summary; @@ -78,10 +77,6 @@ mod patterns; mod summary; mod vertical; -const MIN_STRING: usize = 10; -// When we get scoped annotations, we should have rustfmt::skip. -const SKIP_ANNOTATION: &'static str = "rustfmt_skip"; - pub trait Spanned { fn span(&self) -> Span; } diff --git a/src/lists.rs b/src/lists.rs index 4bd7d76483a9..e55103d0df81 100644 --- a/src/lists.rs +++ b/src/lists.rs @@ -11,7 +11,7 @@ use std::cmp; use std::iter::Peekable; -use syntax::codemap::{CodeMap, BytePos}; +use syntax::codemap::{BytePos, CodeMap}; use {Indent, Shape}; use comment::{find_comment_end, rewrite_comment, FindUncommented}; diff --git a/src/macros.rs b/src/macros.rs index 3f4adf881200..989aaaaa58c4 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -21,17 +21,17 @@ use syntax::ast; use syntax::codemap::BytePos; -use syntax::parse::token::Token; use syntax::parse::new_parser_from_tts; -use syntax::tokenstream::TokenStream; +use syntax::parse::token::Token; use syntax::symbol; +use syntax::tokenstream::TokenStream; use syntax::util::ThinVec; use Shape; use codemap::SpanUtils; +use comment::{contains_comment, FindUncommented}; +use expr::{rewrite_array, rewrite_call_inner}; use rewrite::{Rewrite, RewriteContext}; -use expr::{rewrite_call_inner, rewrite_array}; -use comment::{FindUncommented, contains_comment}; use utils::mk_sp; const FORCED_BRACKET_MACROS: &'static [&'static str] = &["vec!"]; diff --git a/src/missed_spans.rs b/src/missed_spans.rs index fb0e298bbbf4..ac3ad906d17e 100644 --- a/src/missed_spans.rs +++ b/src/missed_spans.rs @@ -8,12 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use config::WriteMode; -use visitor::FmtVisitor; -use syntax::codemap::{BytePos, Span, Pos}; -use comment::{CodeCharKind, CommentCodeSlices, rewrite_comment}; use Shape; +use comment::{rewrite_comment, CodeCharKind, CommentCodeSlices}; +use config::WriteMode; +use syntax::codemap::{BytePos, Pos, Span}; use utils::mk_sp; +use visitor::FmtVisitor; impl<'a> FmtVisitor<'a> { fn output_at_start(&self) -> bool { diff --git a/src/modules.rs b/src/modules.rs index c8275520ca1a..8e728f98cd1a 100644 --- a/src/modules.rs +++ b/src/modules.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use utils; - -use std::path::{Path, PathBuf}; use std::collections::BTreeMap; +use std::path::{Path, PathBuf}; use syntax::ast; use syntax::codemap; use syntax::parse::parser; +use utils::contains_skip; + /// List all the files containing modules of a crate. /// If a file is used twice in a crate, it appears only once. @@ -46,7 +46,7 @@ fn list_submodules<'a>( debug!("list_submodules: search_dir: {:?}", search_dir); for item in &module.items { if let ast::ItemKind::Mod(ref sub_mod) = item.node { - if !utils::contains_skip(&item.attrs) { + if !contains_skip(&item.attrs) { let is_internal = codemap.span_to_filename(item.span) == codemap.span_to_filename(sub_mod.inner); let dir_path = if is_internal { diff --git a/src/patterns.rs b/src/patterns.rs index bcc57f93189a..544285ec213b 100644 --- a/src/patterns.rs +++ b/src/patterns.rs @@ -8,21 +8,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use Shape; -use codemap::SpanUtils; -use rewrite::{Rewrite, RewriteContext}; -use utils::{wrap_str, format_mutability, mk_sp}; -use lists::{DefinitiveListTactic, SeparatorTactic, itemize_list, struct_lit_shape, - struct_lit_tactic, shape_for_tactic, struct_lit_formatting, write_list}; -use expr::{rewrite_call_inner, rewrite_unary_prefix, rewrite_pair, can_be_overflowed_expr, - wrap_struct_field}; -use types::{rewrite_path, PathContext}; -use super::Spanned; -use comment::FindUncommented; - -use syntax::ast::{self, BindingMode, Pat, PatKind, FieldPat, RangeEnd}; -use syntax::ptr; +use syntax::ast::{self, BindingMode, FieldPat, Pat, PatKind, RangeEnd}; use syntax::codemap::{self, BytePos, Span}; +use syntax::ptr; + +use {Shape, Spanned}; +use codemap::SpanUtils; +use comment::FindUncommented; +use expr::{can_be_overflowed_expr, rewrite_call_inner, rewrite_pair, rewrite_unary_prefix, + wrap_struct_field}; +use lists::{itemize_list, shape_for_tactic, struct_lit_formatting, struct_lit_shape, + struct_lit_tactic, write_list, DefinitiveListTactic, SeparatorTactic}; +use rewrite::{Rewrite, RewriteContext}; +use types::{rewrite_path, PathContext}; +use utils::{format_mutability, mk_sp, wrap_str}; impl Rewrite for Pat { fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option { diff --git a/src/rustfmt_diff.rs b/src/rustfmt_diff.rs index ff35a83cc63b..3e9fd913d7c6 100644 --- a/src/rustfmt_diff.rs +++ b/src/rustfmt_diff.rs @@ -1,7 +1,17 @@ -use std::collections::VecDeque; +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + use diff; -use term; +use std::collections::VecDeque; use std::io; +use term; #[derive(Debug, PartialEq)] pub enum DiffLine { diff --git a/src/string.rs b/src/string.rs index 3efb406e7966..00d8c0875e5b 100644 --- a/src/string.rs +++ b/src/string.rs @@ -10,14 +10,14 @@ // Format string literals. -use unicode_segmentation::UnicodeSegmentation; use regex::Regex; +use unicode_segmentation::UnicodeSegmentation; use Shape; use config::Config; use utils::wrap_str; -use MIN_STRING; +const MIN_STRING: usize = 10; pub struct StringFormat<'a> { pub opener: &'a str, @@ -127,7 +127,7 @@ pub fn rewrite_string<'a>(orig: &str, fmt: &StringFormat<'a>) -> Option #[cfg(test)] mod test { - use super::{StringFormat, rewrite_string}; + use super::{rewrite_string, StringFormat}; #[test] fn issue343() { diff --git a/src/types.rs b/src/types.rs index edab375b02de..877502f153c4 100644 --- a/src/types.rs +++ b/src/types.rs @@ -8,24 +8,24 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::ops::Deref; use std::iter::ExactSizeIterator; +use std::ops::Deref; use syntax::abi; -use syntax::ast::{self, Mutability, FunctionRetTy}; -use syntax::codemap::{self, Span, BytePos}; +use syntax::ast::{self, FunctionRetTy, Mutability}; +use syntax::codemap::{self, BytePos, Span}; use syntax::print::pprust; use syntax::symbol::keywords; use {Shape, Spanned}; use codemap::SpanUtils; -use items::{format_generics_item_list, generics_shape_from_config}; -use lists::{write_list, itemize_list, ListFormatting, SeparatorTactic, ListTactic, - definitive_tactic}; -use rewrite::{Rewrite, RewriteContext}; -use utils::{extra_offset, format_mutability, colon_spaces, wrap_str, mk_sp, last_line_width}; -use expr::{rewrite_unary_prefix, rewrite_pair, rewrite_tuple, wrap_args_with_parens}; use config::{IndentStyle, Style, TypeDensity}; +use expr::{rewrite_pair, rewrite_tuple, rewrite_unary_prefix, wrap_args_with_parens}; +use items::{format_generics_item_list, generics_shape_from_config}; +use lists::{definitive_tactic, itemize_list, write_list, ListFormatting, ListTactic, + SeparatorTactic}; +use rewrite::{Rewrite, RewriteContext}; +use utils::{colon_spaces, extra_offset, format_mutability, last_line_width, mk_sp, wrap_str}; #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum PathContext { diff --git a/src/utils.rs b/src/utils.rs index bdf5c2e4b5e4..dc511fc31017 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -11,15 +11,16 @@ use std::borrow::Cow; use std::cmp::Ordering; -use syntax::ast::{self, Visibility, Attribute, MetaItem, MetaItemKind, NestedMetaItem, - NestedMetaItemKind, Path}; -use syntax::codemap::{BytePos, Span, NO_EXPANSION}; use syntax::abi; +use syntax::ast::{self, Attribute, MetaItem, MetaItemKind, NestedMetaItem, NestedMetaItemKind, + Path, Visibility}; +use syntax::codemap::{BytePos, Span, NO_EXPANSION}; use Shape; use rewrite::{Rewrite, RewriteContext}; -use SKIP_ANNOTATION; +// When we get scoped annotations, we should have rustfmt::skip. +const SKIP_ANNOTATION: &'static str = "rustfmt_skip"; // Computes the length of a string's last line, minus offset. pub fn extra_offset(text: &str, shape: Shape) -> usize { diff --git a/src/vertical.rs b/src/vertical.rs index d6b344435186..04d9ac9d35b9 100644 --- a/src/vertical.rs +++ b/src/vertical.rs @@ -12,6 +12,9 @@ use std::cmp; +use syntax::ast; +use syntax::codemap::{BytePos, Span}; + use {Indent, Shape, Spanned}; use codemap::SpanUtils; use comment::contains_comment; @@ -21,9 +24,6 @@ use lists::{definitive_tactic, itemize_list, write_list, ListFormatting, ListTac use rewrite::{Rewrite, RewriteContext}; use utils::{contains_skip, mk_sp}; -use syntax::ast; -use syntax::codemap::{Span, BytePos}; - pub trait AlignedItem { fn skip(&self) -> bool; fn get_span(&self) -> Span; diff --git a/src/visitor.rs b/src/visitor.rs index 6f81496856b4..97b6ce292695 100644 --- a/src/visitor.rs +++ b/src/visitor.rs @@ -10,24 +10,23 @@ use std::cmp; +use strings::string_buffer::StringBuffer; use syntax::{ast, ptr, visit}; -use syntax::codemap::{CodeMap, Span, BytePos}; +use syntax::codemap::{BytePos, CodeMap, Span}; use syntax::parse::ParseSess; -use strings::string_buffer::StringBuffer; - use {Indent, Shape}; -use expr::{format_expr, ExprType}; -use utils::{self, mk_sp}; use codemap::{LineRangeUtils, SpanUtils}; use comment::{contains_comment, FindUncommented}; -use config::Config; -use rewrite::{Rewrite, RewriteContext}; use comment::rewrite_comment; -use macros::{rewrite_macro, MacroPosition}; -use items::{rewrite_static, rewrite_associated_type, rewrite_associated_impl_type, - rewrite_type_alias, format_impl, format_trait}; +use config::Config; +use expr::{format_expr, ExprType}; +use items::{format_impl, format_trait, rewrite_associated_impl_type, rewrite_associated_type, + rewrite_static, rewrite_type_alias}; use lists::{itemize_list, write_list, DefinitiveListTactic, ListFormatting, SeparatorTactic}; +use macros::{rewrite_macro, MacroPosition}; +use rewrite::{Rewrite, RewriteContext}; +use utils::{self, mk_sp}; fn is_use_item(item: &ast::Item) -> bool { match item.node {