mirror of
https://github.com/eza-community/eza
synced 2024-09-30 05:06:30 +00:00
refactor: change cast to coertion, remove rustfmt skip and clippy lint ignore directives
This commit is contained in:
parent
0647d04783
commit
b6e5b2af21
|
@ -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 }
|
||||
|
|
Loading…
Reference in a new issue