parent
55ac062da0
commit
1869888b1a
4 changed files with 6 additions and 11 deletions
|
|
@ -130,11 +130,6 @@ fn make_opts() -> Options {
|
||||||
"Format specified line ranges. See README for more detail on the JSON format.",
|
"Format specified line ranges. See README for more detail on the JSON format.",
|
||||||
"JSON",
|
"JSON",
|
||||||
);
|
);
|
||||||
opts.optflag(
|
|
||||||
"",
|
|
||||||
"verbose-diff",
|
|
||||||
"Emit a more verbose diff, indicating the end of lines.",
|
|
||||||
);
|
|
||||||
opts.optflag("h", "help", "Show this message");
|
opts.optflag("h", "help", "Show this message");
|
||||||
opts.optflag("", "skip-children", "Don't reformat child modules");
|
opts.optflag("", "skip-children", "Don't reformat child modules");
|
||||||
opts.optflag(
|
opts.optflag(
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,6 @@ create_config! {
|
||||||
|
|
||||||
// Not user-facing
|
// Not user-facing
|
||||||
verbose: Verbosity, Verbosity::Normal, false, "How much to information to emit to the user";
|
verbose: Verbosity, Verbosity::Normal, false, "How much to information to emit to the user";
|
||||||
verbose_diff: bool, false, false, "Emit verbose diffs";
|
|
||||||
file_lines: FileLines, FileLines::all(), false,
|
file_lines: FileLines, FileLines::all(), false,
|
||||||
"Lines to format; this is not supported in rustfmt.toml, and can only be specified \
|
"Lines to format; this is not supported in rustfmt.toml, and can only be specified \
|
||||||
via the --file-lines option";
|
via the --file-lines option";
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,6 @@ pub struct CliOptions {
|
||||||
skip_children: Option<bool>,
|
skip_children: Option<bool>,
|
||||||
quiet: bool,
|
quiet: bool,
|
||||||
verbose: bool,
|
verbose: bool,
|
||||||
verbose_diff: bool,
|
|
||||||
pub(super) config_path: Option<PathBuf>,
|
pub(super) config_path: Option<PathBuf>,
|
||||||
write_mode: Option<WriteMode>,
|
write_mode: Option<WriteMode>,
|
||||||
color: Option<Color>,
|
color: Option<Color>,
|
||||||
|
|
@ -347,7 +346,6 @@ impl CliOptions {
|
||||||
if options.verbose && options.quiet {
|
if options.verbose && options.quiet {
|
||||||
return Err(format_err!("Can't use both `--verbose` and `--quiet`"));
|
return Err(format_err!("Can't use both `--verbose` and `--quiet`"));
|
||||||
}
|
}
|
||||||
options.verbose_diff = matches.opt_present("verbose-diff");
|
|
||||||
|
|
||||||
let unstable_features = matches.opt_present("unstable-features");
|
let unstable_features = matches.opt_present("unstable-features");
|
||||||
let rust_nightly = option_env!("CFG_RELEASE_CHANNEL")
|
let rust_nightly = option_env!("CFG_RELEASE_CHANNEL")
|
||||||
|
|
@ -404,7 +402,6 @@ impl CliOptions {
|
||||||
} else {
|
} else {
|
||||||
config.set().verbose(Verbosity::Normal);
|
config.set().verbose(Verbosity::Normal);
|
||||||
}
|
}
|
||||||
config.set().verbose_diff(self.verbose_diff);
|
|
||||||
config.set().file_lines(self.file_lines);
|
config.set().file_lines(self.file_lines);
|
||||||
config.set().unstable_features(self.unstable_features);
|
config.set().unstable_features(self.unstable_features);
|
||||||
if let Some(skip_children) = self.skip_children {
|
if let Some(skip_children) = self.skip_children {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use config::{Color, Config};
|
use config::{Color, Config, Verbosity};
|
||||||
use diff;
|
use diff;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
@ -154,7 +154,11 @@ where
|
||||||
F: Fn(u32) -> String,
|
F: Fn(u32) -> String,
|
||||||
{
|
{
|
||||||
let color = config.color();
|
let color = config.color();
|
||||||
let line_terminator = if config.verbose_diff() { "⏎" } else { "" };
|
let line_terminator = if config.verbose() == Verbosity::Verbose {
|
||||||
|
"⏎"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
};
|
||||||
|
|
||||||
let mut writer = OutputWriter::new(color);
|
let mut writer = OutputWriter::new(color);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue