about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2016-04-22 18:53:39 +1200
committerNick Cameron <ncameron@mozilla.com>2016-04-22 18:53:39 +1200
commit9761cf71d8384db2a75c7595b082dd7764575851 (patch)
tree5ad85e1cc2d34f8d6d48e92c81e48cff0513cac3 /src
parent95ff52f06fce389f2d5634c8b15916419cd876a8 (diff)
Tests
Diffstat (limited to 'src')
-rw-r--r--src/bin/cargo-fmt.rs8
-rw-r--r--src/bin/rustfmt.rs9
-rw-r--r--src/chains.rs10
-rw-r--r--src/items.rs2
-rw-r--r--src/missed_spans.rs8
5 files changed, 17 insertions, 20 deletions
diff --git a/src/bin/cargo-fmt.rs b/src/bin/cargo-fmt.rs
index c033851f98a..575e25ed965 100644
--- a/src/bin/cargo-fmt.rs
+++ b/src/bin/cargo-fmt.rs
@@ -201,9 +201,9 @@ fn format_files(files: &Vec<PathBuf>,
         println!("");
     }
     let mut command = try!(Command::new("rustfmt")
-                               .stdout(stdout)
-                               .args(files)
-                               .args(fmt_args)
-                               .spawn());
+        .stdout(stdout)
+        .args(files)
+        .args(fmt_args)
+        .spawn());
     command.wait()
 }
diff --git a/src/bin/rustfmt.rs b/src/bin/rustfmt.rs
index 472098f59eb..2472001c38b 100644
--- a/src/bin/rustfmt.rs
+++ b/src/bin/rustfmt.rs
@@ -191,7 +191,7 @@ fn execute(opts: &Options) -> FmtResult<Summary> {
         Operation::Stdin { input, config_path } => {
             // try to read config from local directory
             let (mut config, _) = match_cli_path_or_file(config_path, &env::current_dir().unwrap())
-                                      .expect("Error resolving config");
+                .expect("Error resolving config");
 
             // write_mode is always Plain for Stdin.
             config.write_mode = WriteMode::Plain;
@@ -205,8 +205,7 @@ fn execute(opts: &Options) -> FmtResult<Summary> {
             // Load the config path file if provided
             if let Some(config_file) = config_path {
                 let (cfg_tmp, path_tmp) = resolve_config(config_file.as_ref())
-                                              .expect(&format!("Error resolving config for {:?}",
-                                                               config_file));
+                    .expect(&format!("Error resolving config for {:?}", config_file));
                 config = cfg_tmp;
                 path = path_tmp;
             };
@@ -219,9 +218,7 @@ fn execute(opts: &Options) -> FmtResult<Summary> {
                 // Check the file directory if the config-path could not be read or not provided
                 if path.is_none() {
                     let (config_tmp, path_tmp) = resolve_config(file.parent().unwrap())
-                                                     .expect(&format!("Error resolving config \
-                                                                       for {}",
-                                                                      file.display()));
+                        .expect(&format!("Error resolving config for {}", file.display()));
                     if let Some(path) = path_tmp.as_ref() {
                         println!("Using rustfmt config file {} for {}",
                                  path.display(),
diff --git a/src/chains.rs b/src/chains.rs
index 5d2ce8fedf7..ec9e6685878 100644
--- a/src/chains.rs
+++ b/src/chains.rs
@@ -144,9 +144,8 @@ pub fn rewrite_chain(expr: &ast::Expr,
 
     // Total of all items excluding the last.
     let almost_total = rewrites[..rewrites.len() - 1]
-                           .iter()
-                           .fold(0, |a, b| a + first_line_width(b)) +
-                       parent_rewrite.len();
+        .iter()
+        .fold(0, |a, b| a + first_line_width(b)) + parent_rewrite.len();
     let total_width = almost_total + first_line_width(rewrites.last().unwrap());
 
     let veto_single_line = if context.config.take_source_hints && subexpr_list.len() > 1 {
@@ -271,8 +270,9 @@ fn chain_indent(context: &RewriteContext, offset: Indent) -> Indent {
 fn hacked_chain_indent(context: &RewriteContext, _offset: Indent) -> Indent {
     match context.config.chain_indent {
         BlockIndentStyle::Inherit => context.block_indent,
-        BlockIndentStyle::Visual |
-        BlockIndentStyle::Tabbed => context.block_indent.block_indent(context.config),
+        BlockIndentStyle::Visual | BlockIndentStyle::Tabbed => {
+            context.block_indent.block_indent(context.config)
+        }
     }
 }
 
diff --git a/src/items.rs b/src/items.rs
index 2566d9a436b..19dad7f866c 100644
--- a/src/items.rs
+++ b/src/items.rs
@@ -912,7 +912,7 @@ fn format_tuple_struct(context: &RewriteContext,
         // know that earlier, so the where clause will not be indented properly.
         result.push('\n');
         result.push_str(&(context.block_indent + (context.config.tab_spaces - 1))
-                             .to_string(context.config));
+            .to_string(context.config));
     }
     result.push_str(&where_clause_str);
 
diff --git a/src/missed_spans.rs b/src/missed_spans.rs
index 092cc0093f1..3d1ef21478e 100644
--- a/src/missed_spans.rs
+++ b/src/missed_spans.rs
@@ -112,10 +112,10 @@ impl<'a> FmtVisitor<'a> {
         for (kind, offset, subslice) in CommentCodeSlices::new(snippet) {
             if let CodeCharKind::Comment = kind {
                 let last_char = big_snippet[..(offset + big_diff)]
-                                    .chars()
-                                    .rev()
-                                    .skip_while(|rev_c| [' ', '\t'].contains(&rev_c))
-                                    .next();
+                    .chars()
+                    .rev()
+                    .skip_while(|rev_c| [' ', '\t'].contains(&rev_c))
+                    .next();
 
                 let fix_indent = last_char.map_or(true, |rev_c| ['{', '\n'].contains(&rev_c));