clippy: Deny and fix `wildcard_enum_match_arm`

This commit is contained in:
Adrian Duke 2026-01-13 14:59:55 +00:00 committed by Lorenz Leutgeb
parent 001aba0d29
commit 9cc2c869b4
8 changed files with 20 additions and 10 deletions

View File

@ -82,6 +82,7 @@ radicle-surf = "0.26.0"
clippy.type_complexity = "allow" clippy.type_complexity = "allow"
clippy.enum_variant_names = "allow" clippy.enum_variant_names = "allow"
clippy.fallible_impl_from = "deny" clippy.fallible_impl_from = "deny"
clippy.wildcard_enum_match_arm = "deny"
[profile.container] [profile.container]
inherits = "release" inherits = "release"

View File

@ -453,7 +453,8 @@ fn show(
.spawn()? .spawn()?
.wait()?; .wait()?;
} }
notification => { notification @ NotificationKind::Cob { .. }
| notification @ NotificationKind::Unknown { .. } => {
term::json::to_pretty(&notification, Path::new("notification.json"))?.print(); term::json::to_pretty(&notification, Path::new("notification.json"))?.print();
} }
} }

View File

@ -196,7 +196,7 @@ impl Command {
// Special handling for `--edit` will be removed in the future. // Special handling for `--edit` will be removed in the future.
| Command::Edit { .. } => true, | Command::Edit { .. } => true,
Command::Comment(args) => !args.is_edit(), Command::Comment(args) => !args.is_edit(),
_ => false, Command::Cache{..} | Command::Show { .. } | Command::List(_) => false,
} }
} }
} }

View File

@ -186,7 +186,10 @@ impl ReviewItem {
Self::FileAdded { hunk, .. } => hunk.as_ref(), Self::FileAdded { hunk, .. } => hunk.as_ref(),
Self::FileDeleted { hunk, .. } => hunk.as_ref(), Self::FileDeleted { hunk, .. } => hunk.as_ref(),
Self::FileModified { hunk, .. } => hunk.as_ref(), Self::FileModified { hunk, .. } => hunk.as_ref(),
_ => None, Self::FileMoved { .. }
| Self::FileCopied { .. }
| Self::FileEofChanged { .. }
| Self::FileModeChanged { .. } => None,
} }
} }
@ -277,7 +280,7 @@ impl ReviewItem {
EofNewLine::OldMissing => { EofNewLine::OldMissing => {
VStack::default().child(term::Label::new("`\\n` added at end-of-file")) VStack::default().child(term::Label::new("`\\n` added at end-of-file"))
} }
_ => VStack::default(), EofNewLine::BothMissing | EofNewLine::NoneMissing => VStack::default(),
}, },
Self::FileModeChanged { .. } => VStack::default(), Self::FileModeChanged { .. } => VStack::default(),
} }

View File

@ -37,7 +37,7 @@ impl Error {
match self { match self {
Self::UnexpectedEof => true, Self::UnexpectedEof => true,
Self::Io(e) => e.kind() == io::ErrorKind::UnexpectedEof, Self::Io(e) => e.kind() == io::ErrorKind::UnexpectedEof,
_ => false, Self::Syntax(_) | Self::ParseInt(_) | Self::Utf8(_) => false,
} }
} }
} }

View File

@ -87,7 +87,7 @@ impl SyncError {
fn is_connection_err(&self) -> bool { fn is_connection_err(&self) -> bool {
match self { match self {
Self::Node(e) => e.is_connection_err(), Self::Node(e) => e.is_connection_err(),
_ => false, Self::Repository(_) | Self::AllSeedsTimedOut | Self::Target(_) => false,
} }
} }
} }

View File

@ -102,6 +102,9 @@ where
/// Adds a hint to the COB out-of-date database error. /// Adds a hint to the COB out-of-date database error.
fn with_hint(e: profile::Error) -> anyhow::Error { fn with_hint(e: profile::Error) -> anyhow::Error {
// There are many types that aren't `profile::Error::CobsCache`; specifying them all in an
// error path seems overly verbose with little value.
#[allow(clippy::wildcard_enum_match_arm)]
match e { match e {
profile::Error::CobsCache(cob::cache::Error::OutOfDate) => { profile::Error::CobsCache(cob::cache::Error::OutOfDate) => {
anyhow::Error::from(terminal::args::Error::WithHint { anyhow::Error::from(terminal::args::Error::WithHint {

View File

@ -234,10 +234,12 @@ mod sqlite_impls {
code: None, code: None,
message: Some(e.to_string()), message: Some(e.to_string()),
}), }),
_ => Err(Error { Value::Binary(_) | Value::Float(_) | Value::Integer(_) | Value::Null => {
code: None, Err(Error {
message: Some(format!("sql: invalid type `{:?}` for id", value.kind())), code: None,
}), message: Some(format!("sql: invalid type `{:?}` for id", value.kind())),
})
}
} }
} }
} }