Repository: sharkdp/bat
File: src/bin/bat/app.rs (Rust)

Code before:
                }
            }),
            show_nonprintable: self.matches.is_present("show-all"),
            wrapping_mode: if self.interactive_output || maybe_term_width.is_some() {
                match self.matches.value_of("wrap") {
                    Some("character") => WrappingMode::Character,
                    Some("never") => WrappingMode::NoWrapping,
                    Some("auto") | None => {
                        if style_components.plain() {
                            WrappingMode::NoWrapping
                        } else {
                            WrappingMode::Character
                        }
                    }
                    _ => unreachable!("other values for --paging are not allowed"),
                }
            } else {
                // We don't have the tty width when piping to another program.
                // There's no point in wrapping when this is the case.
                WrappingMode::NoWrapping
            },
            colored_output: self.matches.is_present("force-colorization")
                || match self.matches.value_of("color") {
                    Some("always") => true,
                    Some("never") => false,
                    _ => env::var_os("NO_COLOR").is_none() && self.interactive_output,
                },
            paging_mode,
            term_width: maybe_term_width.unwrap_or(Term::stdout().size().1 as usize),
            loop_through: !(self.interactive_output
                || self.matches.value_of("color") == Some("always")
                || self.matches.value_of("decorations") == Some("always")
                || self.matches.is_present("force-colorization")),
            tab_width: self
                .matches
                .value_of("tabs")
                .map(String::from)
                .or_else(|| env::var("BAT_TABS").ok())
                .and_then(|t| t.parse().ok())
                .unwrap_or(
                    if style_components.plain() && paging_mode == PagingMode::Never {
                        0
                    } else {
                        4
                    },
                ),
            theme: self
                .matches
                .value_of("theme")
                .map(String::from)
                .or_else(|| env::var("BAT_THEME").ok())

Review comment (suggestion):
Honestly, I prefer the other way. By removing the `Some("auto")`, it no longer explicitly covers every possible option.

It may be redundant, but it's more clear.

Code after:
                }
            }),
            show_nonprintable: self.matches.is_present("show-all"),
            wrapping_mode: if self.interactive_output || maybe_term_width.is_some() {
                match self.matches.value_of("wrap") {
                    Some("character") => WrappingMode::Character,
                    Some("never") => WrappingMode::NoWrapping,
                    Some("auto") | None => {
                        if style_components.plain() {
                            WrappingMode::NoWrapping
                        } else {
                            WrappingMode::Character
                        }
                    }
                    _ => unreachable!("other values for --paging are not allowed"),
                }
            } else {
                // We don't have the tty width when piping to another program.
                // There's no point in wrapping when this is the case.
                WrappingMode::NoWrapping
            },
            colored_output: self.matches.is_present("force-colorization")
                || match self.matches.value_of("color") {
                    Some("always") => true,
                    Some("never") => false,
                    Some("auto") => env::var_os("NO_COLOR").is_none() && self.interactive_output,
                    _ => unreachable!("other values for --color are not allowed"),
                },
            paging_mode,
            term_width: maybe_term_width.unwrap_or(Term::stdout().size().1 as usize),
            loop_through: !(self.interactive_output
                || self.matches.value_of("color") == Some("always")
                || self.matches.value_of("decorations") == Some("always")
                || self.matches.is_present("force-colorization")),
            tab_width: self
                .matches
                .value_of("tabs")
                .map(String::from)
                .or_else(|| env::var("BAT_TABS").ok())
                .and_then(|t| t.parse().ok())
                .unwrap_or(
                    if style_components.plain() && paging_mode == PagingMode::Never {
                        0
                    } else {
                        4
                    },
                ),
            theme: self
                .matches
                .value_of("theme")
                .map(String::from)