]> git.lizzy.rs Git - rust.git/commitdiff
Add an option to inhibit warning on write-mode change
authortopecongiro <seuchida@gmail.com>
Mon, 26 Jun 2017 05:11:34 +0000 (14:11 +0900)
committertopecongiro <seuchida@gmail.com>
Tue, 27 Jun 2017 02:28:28 +0000 (11:28 +0900)
src/bin/rustfmt.rs

index 4d2f1cdc041c6408d86801fc29c7c3430264d075..d2f2f3d761b74fec5129311bb48b659f3e93bcaf 100644 (file)
@@ -78,7 +78,7 @@ fn from_matches(matches: &Matches) -> FmtResult<CliOptions> {
                     format!("Invalid write-mode: {}", write_mode),
                 ));
             }
-        } else {
+        } else if !matches.opt_present("no-warn-write-mode") {
             println!(
                 "Warning: the default write-mode for Rustfmt will soon change to overwrite \
                  - this will not leave backups of changed files."
@@ -120,6 +120,12 @@ fn make_opts() -> Options {
     opts.optflag("h", "help", "show this message");
     opts.optflag("V", "version", "show version information");
     opts.optflag("v", "verbose", "print verbose output");
+    // Suppress warning. Remove this option after the default write mode changed to overwrite.
+    opts.optflag(
+        "w",
+        "no-warn-write-mode",
+        "inhibit warning about write-mode change",
+    );
     opts.optopt(
         "",
         "write-mode",