refactor: mark public enums as non-exhaustive to improve API stability

Apply the #[non-exhaustive] attribute to ClientError and WarningKind to prevent breaking changes when adding new variants. Handle the catch-all case in the CLI formatter.
This commit is contained in:
Nils Andreas Svee committed 2026-05-11 12:33:40 +07:00
1 parent 8d1d0f50de
commit 21bc7805f7
3 files changed
+3

No files matched your search

+1
View File
@@ -831,6 +831,7 @@ fn warning_kind(kind: WarningKind) -> &'static str {
WarningKind::MalformedOrUnrelatedPacket => "malformed_or_unrelated_packet",
WarningKind::WrongToken => "wrong_token",
WarningKind::UntrackedReply => "untracked_reply",
_ => "unknown",
}
}
+1
View File
@@ -3,6 +3,7 @@ use std::{io, time::Duration};
use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum ClientError {
#[error("failed to resolve server address {addr:?}")]
Resolve { addr: String },
+1
View File
@@ -101,6 +101,7 @@ pub enum ClientEvent {
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum WarningKind {
MalformedOrUnrelatedPacket,
WrongToken,