fix: deal with new lints from beta clippy (#3389)

Most of this is trivial, apart from the rename of the `clippy::derive_hash_xor_eq` lint to `clippy::derived_hash_with_manual_eq`.

Instead of allowing that lint, we manually implement `PartialEq` and add a comment why the difference between the `PartialEq` and `Hash` implementations are okay.
This commit is contained in:
Thomas Eizinger
2023-02-01 00:20:26 +11:00
committed by GitHub
parent 3ec7c797e5
commit 8f3b7e3876
5 changed files with 20 additions and 23 deletions

View File

@ -636,20 +636,15 @@ pub enum NotifyHandler {
}
/// The options which connections to close.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub enum CloseConnection {
/// Disconnect a particular connection.
One(ConnectionId),
/// Disconnect all connections.
#[default]
All,
}
impl Default for CloseConnection {
fn default() -> Self {
CloseConnection::All
}
}
/// Enumeration with the list of the possible events
/// to pass to [`on_swarm_event`](NetworkBehaviour::on_swarm_event).
pub enum FromSwarm<'a, Handler: IntoConnectionHandler> {

View File

@ -320,11 +320,12 @@ impl WithoutPeerIdWithAddress {
/// .condition(PeerCondition::Disconnected)
/// .build();
/// ```
#[derive(Debug, Copy, Clone)]
#[derive(Debug, Copy, Clone, Default)]
pub enum PeerCondition {
/// A new dialing attempt is initiated _only if_ the peer is currently
/// considered disconnected, i.e. there is no established connection
/// and no ongoing dialing attempt.
#[default]
Disconnected,
/// A new dialing attempt is initiated _only if_ there is currently
/// no ongoing dialing attempt, i.e. the peer is either considered
@ -334,9 +335,3 @@ pub enum PeerCondition {
/// configured connection limits.
Always,
}
impl Default for PeerCondition {
fn default() -> Self {
PeerCondition::Disconnected
}
}

View File

@ -1559,7 +1559,6 @@ where
.new_handler()
.inbound_protocol()
.protocol_info()
.into_iter()
.map(|info| info.protocol_name().to_vec())
.collect();