Skip to content

Commit ea8ef2f

Browse files
committed
refactor(cli): simplify case splitting on clap::error::ErrorKind
1 parent 740af17 commit ea8ef2f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/cli/setup_mode.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ use crate::{
1515

1616
#[cfg_attr(feature = "otel", tracing::instrument)]
1717
pub fn main() -> Result<utils::ExitCode> {
18+
use clap::error::ErrorKind;
19+
1820
let args: Vec<_> = process().args().collect();
1921
let arg1 = args.get(1).map(|a| &**a);
2022

@@ -107,10 +109,7 @@ pub fn main() -> Result<utils::ExitCode> {
107109

108110
let matches = match cli.try_get_matches_from(process().args_os()) {
109111
Ok(matches) => matches,
110-
Err(e)
111-
if e.kind() == clap::error::ErrorKind::DisplayHelp
112-
|| e.kind() == clap::error::ErrorKind::DisplayVersion =>
113-
{
112+
Err(e) if [ErrorKind::DisplayHelp, ErrorKind::DisplayVersion].contains(&e.kind()) => {
114113
write!(process().stdout().lock(), "{e}")?;
115114
return Ok(utils::ExitCode(0));
116115
}

0 commit comments

Comments
 (0)