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.enum_variant_names = "allow"
clippy.fallible_impl_from = "deny"
clippy.wildcard_enum_match_arm = "deny"
[profile.container]
inherits = "release"

View File

@ -453,7 +453,8 @@ fn show(
.spawn()?
.wait()?;
}
notification => {
notification @ NotificationKind::Cob { .. }
| notification @ NotificationKind::Unknown { .. } => {
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.
| Command::Edit { .. } => true,
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::FileDeleted { 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 => {
VStack::default().child(term::Label::new("`\\n` added at end-of-file"))
}
_ => VStack::default(),
EofNewLine::BothMissing | EofNewLine::NoneMissing => VStack::default(),
},
Self::FileModeChanged { .. } => VStack::default(),
}

View File

@ -37,7 +37,7 @@ impl Error {
match self {
Self::UnexpectedEof => true,
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 {
match self {
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.
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 {
profile::Error::CobsCache(cob::cache::Error::OutOfDate) => {
anyhow::Error::from(terminal::args::Error::WithHint {

View File

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