Fix clippy::if_same_then_else warning in --paging=auto logic

This commit is contained in:
Martin Nordholts 2020-12-25 12:22:35 +01:00 committed by David Peter
parent 07bd7503c5
commit 6d1c7d5f57
1 changed files with 3 additions and 4 deletions

View File

@ -82,10 +82,9 @@ impl App {
Some("always") => PagingMode::Always,
Some("never") => PagingMode::Never,
Some("auto") | None => {
if self.matches.occurrences_of("plain") > 1 {
// If we have -pp as an option when in auto mode, the pager should be disabled.
PagingMode::Never
} else if self.matches.is_present("no-paging") {
// If we have -pp as an option when in auto mode, the pager should be disabled.
let extra_plain = self.matches.occurrences_of("plain") > 1;
if extra_plain || self.matches.is_present("no-paging") {
PagingMode::Never
} else if inputs.iter().any(Input::is_stdin) {
// If we are reading from stdin, only enable paging if we write to an