|
|
@@ -54,7 +54,6 @@ pub struct Theme {
|
|
|
}
|
|
|
|
|
|
impl Options {
|
|
|
- #[allow(trivial_casts)] // the `as Box<_>` stuff below warns about this for some reason
|
|
|
pub fn to_theme(&self, isatty: bool) -> Theme {
|
|
|
if self.use_colours == UseColours::Never
|
|
|
|| (self.use_colours == UseColours::Automatic && !isatty)
|
|
|
@@ -69,12 +68,11 @@ impl Options {
|
|
|
let (exts, use_default_filetypes) = self.definitions.parse_color_vars(&mut ui);
|
|
|
|
|
|
// Use between 0 and 2 file name highlighters
|
|
|
- #[rustfmt::skip]
|
|
|
- let exts = match (exts.is_non_empty(), use_default_filetypes) {
|
|
|
- (false, false) => Box::new(NoFileStyle) as Box<_>,
|
|
|
- (false, true) => Box::new(FileTypes) as Box<_>,
|
|
|
- ( true, false) => Box::new(exts) as Box<_>,
|
|
|
- ( true, true) => Box::new((exts, FileTypes)) as Box<_>,
|
|
|
+ let exts: Box<dyn FileStyle> = match (exts.is_non_empty(), use_default_filetypes) {
|
|
|
+ (false, false) => Box::new(NoFileStyle),
|
|
|
+ (false, true) => Box::new(FileTypes),
|
|
|
+ (true, false) => Box::new(exts),
|
|
|
+ (true, true) => Box::new((exts, FileTypes)),
|
|
|
};
|
|
|
|
|
|
Theme { ui, exts }
|