Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
clippy: Deny and fix `wildcard_enum_match_arm`
Adrian Duke committed 3 months ago
commit 9cc2c869b44ae3b03aa466e05314d427101473c9
parent 001aba0d292f1f5f5f334dff8e3d75bf709fe329
8 files changed +20 -10
modified Cargo.toml
@@ -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"
modified crates/radicle-cli/src/commands/inbox.rs
@@ -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();
        }
    }
modified crates/radicle-cli/src/commands/issue/args.rs
@@ -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,
        }
    }
}
modified crates/radicle-cli/src/commands/patch/review/builder.rs
@@ -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(),
        }
modified crates/radicle-cli/src/git/unified_diff.rs
@@ -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,
        }
    }
}
modified crates/radicle-cli/src/node.rs
@@ -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,
        }
    }
}
modified crates/radicle-cli/src/terminal/cob.rs
@@ -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 {
modified crates/radicle-core/src/repo.rs
@@ -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())),
+
                    })
+
                }
            }
        }
    }