From ff898cd1056f4fc23181edbadb7fb495ae9646ef Mon Sep 17 00:00:00 2001 From: Eric Nielsen Date: Thu, 25 May 2017 17:32:21 -0500 Subject: [PATCH] Remove vestigial color function from src/args.rs It's usage was replaced by the `color_choice` function. Also, `color` was outdated, as it didn't include testing for the new "ansi" option. --- src/args.rs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/args.rs b/src/args.rs index cc3f739f..703ab3b5 100644 --- a/src/args.rs +++ b/src/args.rs @@ -35,7 +35,6 @@ pub struct Args { paths: Vec, after_context: usize, before_context: usize, - color: bool, color_choice: termcolor::ColorChoice, colors: ColorSpecs, column: bool, @@ -317,7 +316,6 @@ impl<'a> ArgMatches<'a> { paths: paths, after_context: after_context, before_context: before_context, - color: self.color(), color_choice: self.color_choice(), colors: try!(self.color_specs()), column: self.column(), @@ -665,23 +663,6 @@ impl<'a> ArgMatches<'a> { }) } - /// Returns true if and only if ripgrep should color its output. - fn color(&self) -> bool { - let preference = match self.0.value_of_lossy("color") { - None => "auto".to_string(), - Some(v) => v.into_owned(), - }; - if preference == "always" { - true - } else if self.is_present("vimgrep") { - false - } else if preference == "auto" { - atty::is(atty::Stream::Stdout) || self.is_present("pretty") - } else { - false - } - } - /// Returns the user's color choice based on command line parameters and /// environment. fn color_choice(&self) -> termcolor::ColorChoice {