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:
Narawit Rakket 2022-08-07 16:41:30 +07:00 committed by Abin Simon
parent 685d5a6c2f
commit 1553aafe9d
6 changed files with 14 additions and 29 deletions

View file

@ -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'"),
}
}
}

View file

@ -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'"),
}
}
}

View file

@ -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'"),
}
}
}

View file

@ -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'"),
}
}
}

View file

@ -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'"),
}
}
}

View file

@ -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'"),
}
}
}