From ecf12778fbfbb2bcf028eb2440084edd23067f99 Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Wed, 16 Dec 2015 18:07:59 +1300 Subject: [PATCH] Use replace rather than overwrite for cargo fmt --- Cargo.toml | 2 +- README.md | 3 ++- src/bin/cargo-fmt.rs | 2 +- src/lib.rs | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bcba2f66818b..17bd20a0561a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustfmt" -version = "0.2.0" +version = "0.2.1" authors = ["Nicholas Cameron ", "Marcus Klaas ", "The Rustfmt contributors"] description = "Tool to find and fix Rust formatting issues" repository = "https://github.com/rust-lang-nursery/rustfmt" diff --git a/README.md b/README.md index 88d332de2fdd..3e58da373dda 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,8 @@ screen, for example. You can run `rustfmt --help` for more information. -`cargo fmt` uses `--write-mode=overwrite` by default. +`cargo fmt` uses `--write-mode=replace` by default. + ## Running Rustfmt from your editor diff --git a/src/bin/cargo-fmt.rs b/src/bin/cargo-fmt.rs index f79899ff5b1b..96d7566330ef 100644 --- a/src/bin/cargo-fmt.rs +++ b/src/bin/cargo-fmt.rs @@ -69,7 +69,7 @@ fn format_crate(opts: &Options) { } fn get_fmt_args() -> Vec { - let mut args = vec!["--write-mode=overwrite".to_string()]; + let mut args = vec!["--write-mode=replace".to_string()]; // All arguments after -- are passed to rustfmt args.extend(env::args().skip_while(|a| a != "--").skip(1)); diff --git a/src/lib.rs b/src/lib.rs index 86ab1a73022d..0ee5f71a3556 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -189,7 +189,7 @@ impl Sub for Indent { #[derive(Copy, Clone)] pub enum WriteMode { - // Backups the original file and overwrites the orignal. + // Backsup the original file and overwrites the orignal. Replace, // Overwrites original file without backup. Overwrite,