]> git.lizzy.rs Git - rust.git/blobdiff - src/bin/rustfmt.rs
Fix a typo
[rust.git] / src / bin / rustfmt.rs
index 001f2c8e0f70c1f0d0423ac3b57932fac8019c2d..75b45156acec6d6e7a5f8aaa937fbbd868b13839 100644 (file)
@@ -10,7 +10,6 @@
 
 #![cfg(not(test))]
 
-
 extern crate env_logger;
 extern crate getopts;
 extern crate rustfmt_nightly as rustfmt;
@@ -21,7 +20,7 @@
 use std::path::{Path, PathBuf};
 use std::str::FromStr;
 
-use getopts::{HasArg, Matches, Occur, Options};
+use getopts::{Matches, Options};
 
 use rustfmt::{run, Input, Summary};
 use rustfmt::file_lines::FileLines;
@@ -136,41 +135,45 @@ fn match_cli_path_or_file(
 
 fn make_opts() -> Options {
     let mut opts = Options::new();
-    opts.optflag("h", "help", "show this message");
-    opts.optflag("V", "version", "show version information");
-    opts.optflag("v", "verbose", "print verbose output");
-    opts.optopt(
-        "",
-        "write-mode",
-        "how to write output (not usable when piping from stdin)",
-        "[replace|overwrite|display|plain|diff|coverage|checkstyle]",
-    );
-    opts.optopt(
-        "",
-        "color",
-        "use colored output (if supported)",
-        "[always|never|auto]",
-    );
-    opts.optflag("", "skip-children", "don't reformat child modules");
 
+    opts.optflag("h", "help", "Show this message");
+    opts.optflag("V", "version", "Show version information");
+    opts.optflag("v", "verbose", "Print verbose output");
+    opts.optflag("", "skip-children", "Don't reformat child modules");
     opts.optflag(
         "",
         "unstable-features",
         "Enables unstable features. Only available on nightly channel",
     );
-
     opts.optflag(
         "",
         "config-help",
-        "show details of rustfmt configuration options",
+        "Show details of rustfmt configuration options",
     );
-    opts.opt(
+    opts.optflag(
+        "",
+        "error-on-unformatted",
+        "Error if unable to get comments or string literals within max_width, \
+         or they are left with trailing whitespaces",
+    );
+
+    opts.optopt(
+        "",
+        "write-mode",
+        "How to write output (not usable when piping from stdin)",
+        "[replace|overwrite|display|plain|diff|coverage|checkstyle]",
+    );
+    opts.optopt(
+        "",
+        "color",
+        "Use colored output (if supported)",
+        "[always|never|auto]",
+    );
+    opts.optopt(
         "",
         "dump-default-config",
         "Dumps default configuration to PATH. PATH defaults to stdout, if omitted.",
         "PATH",
-        HasArg::Maybe,
-        Occur::Optional,
     );
     opts.optopt(
         "",