mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-10 06:47:34 +00:00
Sort imports in alphabetical and consistent order
This commit is contained in:
parent
27b04fec1a
commit
6fd291981e
@ -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();
|
||||
|
@ -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<error::Error + Send + Sync>;
|
||||
type FmtResult<T> = std::result::Result<T, FmtError>;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -7,10 +7,11 @@
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<T>(out: &mut T, mode: WriteMode) -> Result<(), io::Error>
|
||||
where
|
||||
|
@ -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]
|
||||
|
@ -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 ),+ $(,)*) => {
|
||||
|
46
src/expr.rs
46
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<String> {
|
||||
format_expr(self, ExprType::SubExpression, context, shape)
|
||||
|
@ -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<FileRecord>;
|
||||
|
@ -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 {
|
||||
|
@ -13,6 +13,7 @@
|
||||
// associated issue number.
|
||||
|
||||
use std::fmt;
|
||||
|
||||
pub use config::ReportTactic;
|
||||
|
||||
const TO_DO_CHARS: &'static [char] = &['T', 'O', 'D', 'O'];
|
||||
|
24
src/items.rs
24
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(
|
||||
|
31
src/lib.rs
31
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;
|
||||
}
|
||||
|
@ -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};
|
||||
|
@ -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!"];
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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<String> {
|
||||
|
@ -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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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 {
|
||||
|
@ -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<String>
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::{StringFormat, rewrite_string};
|
||||
use super::{rewrite_string, StringFormat};
|
||||
|
||||
#[test]
|
||||
fn issue343() {
|
||||
|
18
src/types.rs
18
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 {
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user