mirror of
https://github.com/lsd-rs/lsd
synced 2024-11-10 14:24:27 +00:00
refactor: simplify panic message in unreachable!
Mention `clap` in the comment instead because this information is useful for developers but can confuse users
This commit is contained in:
parent
685d5a6c2f
commit
1553aafe9d
6 changed files with 14 additions and 29 deletions
|
@ -106,11 +106,8 @@ impl ColorOption {
|
|||
"always" => Self::Always,
|
||||
"auto" => Self::Auto,
|
||||
"never" => Self::Never,
|
||||
other => {
|
||||
unreachable!(
|
||||
"Invalid value '{other}' for 'color' flag should be handled by `clap`"
|
||||
);
|
||||
}
|
||||
// Invalid value should be handled by `clap` when building an `ArgMatches`
|
||||
other => unreachable!("Invalid value '{other}' for 'color'"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,8 @@ impl HyperlinkOption {
|
|||
"always" => Self::Always,
|
||||
"auto" => Self::Auto,
|
||||
"never" => Self::Never,
|
||||
other => unreachable!(
|
||||
"Invalid value '{other}' for 'hyperlink' flag should be handled by `clap`"
|
||||
),
|
||||
// Invalid value should be handled by `clap` when building an `ArgMatches`
|
||||
other => unreachable!("Invalid value '{other}' for 'hyperlink'"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,9 +51,8 @@ impl IconOption {
|
|||
"always" => Self::Always,
|
||||
"auto" => Self::Auto,
|
||||
"never" => Self::Never,
|
||||
other => {
|
||||
unreachable!("Invalid value '{other}' for 'icon' flag should be handled by `clap`");
|
||||
}
|
||||
// Invalid value should be handled by `clap` when building an `ArgMatches`
|
||||
other => unreachable!("Invalid value '{other}' for 'icon'"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,11 +108,8 @@ impl IconTheme {
|
|||
match value {
|
||||
"fancy" => Self::Fancy,
|
||||
"unicode" => Self::Unicode,
|
||||
other => {
|
||||
unreachable!(
|
||||
"Invalid value '{other}' for 'icon-theme' flag should be handled by `clap`"
|
||||
);
|
||||
}
|
||||
// Invalid value should be handled by `clap` when building an `ArgMatches`
|
||||
other => unreachable!("Invalid value '{other}' for 'icon-theme'"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,11 +23,8 @@ impl PermissionFlag {
|
|||
match value {
|
||||
"rwx" => Self::Rwx,
|
||||
"octal" => Self::Octal,
|
||||
other => {
|
||||
unreachable!(
|
||||
"Invalid value '{other}' for 'permission' flag should be handled by `clap`"
|
||||
);
|
||||
}
|
||||
// Invalid value should be handled by `clap` when building an `ArgMatches`
|
||||
other => unreachable!("Invalid value '{other}' for 'permission'"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,8 @@ impl SizeFlag {
|
|||
"default" => Self::Default,
|
||||
"short" => Self::Short,
|
||||
"bytes" => Self::Bytes,
|
||||
other => {
|
||||
unreachable!("Invalid value '{other}' for 'size' flag should be handled by `clap`");
|
||||
}
|
||||
// Invalid value should be handled by `clap` when building an `ArgMatches`
|
||||
other => unreachable!("Invalid value '{other}' for 'size'"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,11 +142,8 @@ impl DirGrouping {
|
|||
"first" => Self::First,
|
||||
"last" => Self::Last,
|
||||
"none" => Self::None,
|
||||
other => {
|
||||
unreachable!(
|
||||
"Invalid value '{other}' for 'group-dirs' flag should be handled by `clap`"
|
||||
);
|
||||
}
|
||||
// Invalid value should be handled by `clap` when building an `ArgMatches`
|
||||
other => unreachable!("Invalid value '{other}' for 'group-dirs'"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue