style: crank clippy to pedantic+nursery and fix all lints

Enable the full clippy all + pedantic + nursery groups as workspace warnings,
with a small documented allow-list for the pedantic/nursery lints this project
intentionally does not follow (rustdoc-style requirements, deliberate numeric
casts in the protocol/UI layers, and a few noisy nursery lints). Also enable
the rust unused_lifetimes and unsafe_op_in_unsafe_fn lints.

Fixed every resulting warning (527 -> 0) mechanically per clippy's suggestions:
inline format args, const fns, item ordering, let-else, redundant clones,
map_or, cast_lossless, Eq derives, associated-fn conversions for methods that
never used self, and removing unnecessary Result wrappers whose call sites could
never propagate an error. No runtime behavior changed; cargo fmt applied.

cargo clippy --workspace --all-targets: 0 warnings. All tests pass.
This commit is contained in:
michel
2026-07-19 00:09:17 +02:00
parent b149a8ecf2
commit e72c8a5c07
37 changed files with 482 additions and 433 deletions
+9 -8
View File
@@ -60,9 +60,9 @@ impl FromStr for ConnectionType {
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"P" => Ok(ConnectionType::P),
"F" => Ok(ConnectionType::F),
"D" => Ok(ConnectionType::D),
"P" => Ok(Self::P),
"F" => Ok(Self::F),
"D" => Ok(Self::D),
_ => Err(ParseConnectionTypeError),
}
}
@@ -71,11 +71,11 @@ impl FromStr for ConnectionType {
impl fmt::Display for ConnectionType {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let s = match self {
ConnectionType::P => "P",
ConnectionType::F => "F",
ConnectionType::D => "D",
Self::P => "P",
Self::F => "F",
Self::D => "D",
};
write!(f, "{}", s)
write!(f, "{s}")
}
}
@@ -93,7 +93,8 @@ pub struct Peer {
}
impl Peer {
#[allow(clippy::too_many_arguments, dead_code)]
pub fn new(
#[must_use]
pub const fn new(
username: String,
connection_type: ConnectionType,
host: String,