style: Migrate to stable-only rustfmt configuration

- Remove nightly-only features from .rustfmt.toml and vendor/ss58-registry/rustfmt.toml
- Removed features: imports_granularity, wrap_comments, comment_width,
  reorder_impl_items, spaces_around_ranges, binop_separator,
  match_arm_blocks, trailing_semicolon, trailing_comma
- Format all 898 affected files with stable rustfmt
- Ensures long-term reliability without nightly toolchain dependency
This commit is contained in:
2025-12-22 17:12:58 +03:00
parent 65b7f5e640
commit 4c8f281051
898 changed files with 8671 additions and 6432 deletions
@@ -1263,8 +1263,8 @@ impl NetworkBehaviour for Notifications {
for set_id in (0..self.notif_protocols.len()).map(SetId::from) {
match self.peers.entry((peer_id, set_id)).or_insert(PeerState::Poisoned) {
// Requested | PendingRequest => Enabled
st @ &mut PeerState::Requested |
st @ &mut PeerState::PendingRequest { .. } => {
st @ &mut PeerState::Requested
| st @ &mut PeerState::PendingRequest { .. } => {
trace!(target: LOG_TARGET,
"Libp2p => Connected({}, {:?}, {:?}): Connection was requested by PSM.",
peer_id, set_id, endpoint
@@ -1304,10 +1304,10 @@ impl NetworkBehaviour for Notifications {
// In all other states, add this new connection to the list of closed
// inactive connections.
PeerState::Incoming { connections, .. } |
PeerState::Disabled { connections, .. } |
PeerState::DisabledPendingEnable { connections, .. } |
PeerState::Enabled { connections, .. } => {
PeerState::Incoming { connections, .. }
| PeerState::Disabled { connections, .. }
| PeerState::DisabledPendingEnable { connections, .. }
| PeerState::Enabled { connections, .. } => {
trace!(target: LOG_TARGET,
"Libp2p => Connected({}, {:?}, {:?}, {:?}): Secondary connection. Leaving closed.",
peer_id, set_id, endpoint, connection_id);
@@ -1593,9 +1593,9 @@ impl NetworkBehaviour for Notifications {
}
},
PeerState::Requested |
PeerState::PendingRequest { .. } |
PeerState::Backoff { .. } => {
PeerState::Requested
| PeerState::PendingRequest { .. }
| PeerState::Backoff { .. } => {
// This is a serious bug either in this state machine or in libp2p.
error!(target: LOG_TARGET,
"`inject_connection_closed` called for unknown peer {}",
@@ -1629,8 +1629,8 @@ impl NetworkBehaviour for Notifications {
// "Basic" situation: we failed to reach a peer that the peerset
// requested.
st @ PeerState::Requested |
st @ PeerState::PendingRequest { .. } => {
st @ PeerState::Requested
| st @ PeerState::PendingRequest { .. } => {
trace!(target: LOG_TARGET, "PSM <= Dropped({}, {:?})", peer_id, set_id);
self.protocol_controller_handles[usize::from(set_id)]
.dropped(peer_id);
@@ -1639,7 +1639,9 @@ impl NetworkBehaviour for Notifications {
let ban_duration = match st {
PeerState::PendingRequest { timer_deadline, .. }
if timer_deadline > now =>
cmp::max(timer_deadline - now, Duration::from_secs(5)),
{
cmp::max(timer_deadline - now, Duration::from_secs(5))
},
_ => Duration::from_secs(5),
};
@@ -1662,10 +1664,10 @@ impl NetworkBehaviour for Notifications {
// We can still get dial failures even if we are already connected
// to the peer, as an extra diagnostic for an earlier attempt.
st @ PeerState::Disabled { .. } |
st @ PeerState::Enabled { .. } |
st @ PeerState::DisabledPendingEnable { .. } |
st @ PeerState::Incoming { .. } => {
st @ PeerState::Disabled { .. }
| st @ PeerState::Enabled { .. }
| st @ PeerState::DisabledPendingEnable { .. }
| st @ PeerState::Incoming { .. } => {
*entry.into_mut() = st;
},
@@ -1793,8 +1795,8 @@ impl NetworkBehaviour for Notifications {
// more to do.
debug_assert!(matches!(
connec_state,
ConnectionState::OpenDesiredByRemote |
ConnectionState::Closing | ConnectionState::Opening
ConnectionState::OpenDesiredByRemote
| ConnectionState::Closing | ConnectionState::Opening
));
}
} else {
@@ -2005,8 +2007,8 @@ impl NetworkBehaviour for Notifications {
// All connections in `Disabled` and `DisabledPendingEnable` have been sent a
// `Close` message already, and as such ignore any `CloseDesired` message.
state @ PeerState::Disabled { .. } |
state @ PeerState::DisabledPendingEnable { .. } => {
state @ PeerState::Disabled { .. }
| state @ PeerState::DisabledPendingEnable { .. } => {
*entry.into_mut() = state;
},
state => {
@@ -2026,10 +2028,10 @@ impl NetworkBehaviour for Notifications {
match self.peers.get_mut(&(peer_id, set_id)) {
// Move the connection from `Closing` to `Closed`.
Some(PeerState::Incoming { connections, .. }) |
Some(PeerState::DisabledPendingEnable { connections, .. }) |
Some(PeerState::Disabled { connections, .. }) |
Some(PeerState::Enabled { connections, .. }) => {
Some(PeerState::Incoming { connections, .. })
| Some(PeerState::DisabledPendingEnable { connections, .. })
| Some(PeerState::Disabled { connections, .. })
| Some(PeerState::Enabled { connections, .. }) => {
if let Some((_, connec_state)) = connections.iter_mut().find(|(c, s)| {
*c == connection_id && matches!(s, ConnectionState::Closing)
}) {
@@ -2094,8 +2096,8 @@ impl NetworkBehaviour for Notifications {
*connec_state = ConnectionState::Open(notifications_sink);
} else if let Some((_, connec_state)) =
connections.iter_mut().find(|(c, s)| {
*c == connection_id &&
matches!(s, ConnectionState::OpeningThenClosing)
*c == connection_id
&& matches!(s, ConnectionState::OpeningThenClosing)
}) {
*connec_state = ConnectionState::Closing;
} else {
@@ -2105,9 +2107,9 @@ impl NetworkBehaviour for Notifications {
}
},
Some(PeerState::Incoming { connections, .. }) |
Some(PeerState::DisabledPendingEnable { connections, .. }) |
Some(PeerState::Disabled { connections, .. }) => {
Some(PeerState::Incoming { connections, .. })
| Some(PeerState::DisabledPendingEnable { connections, .. })
| Some(PeerState::Disabled { connections, .. }) => {
if let Some((_, connec_state)) = connections.iter_mut().find(|(c, s)| {
*c == connection_id && matches!(s, ConnectionState::OpeningThenClosing)
}) {
@@ -2156,8 +2158,8 @@ impl NetworkBehaviour for Notifications {
*connec_state = ConnectionState::Closed;
} else if let Some((_, connec_state)) =
connections.iter_mut().find(|(c, s)| {
*c == connection_id &&
matches!(s, ConnectionState::OpeningThenClosing)
*c == connection_id
&& matches!(s, ConnectionState::OpeningThenClosing)
}) {
*connec_state = ConnectionState::Closing;
} else {
@@ -2181,17 +2183,17 @@ impl NetworkBehaviour for Notifications {
*entry.into_mut() = PeerState::Enabled { connections };
}
},
mut state @ PeerState::Incoming { .. } |
mut state @ PeerState::DisabledPendingEnable { .. } |
mut state @ PeerState::Disabled { .. } => {
mut state @ PeerState::Incoming { .. }
| mut state @ PeerState::DisabledPendingEnable { .. }
| mut state @ PeerState::Disabled { .. } => {
match &mut state {
PeerState::Incoming { connections, .. } |
PeerState::Disabled { connections, .. } |
PeerState::DisabledPendingEnable { connections, .. } => {
PeerState::Incoming { connections, .. }
| PeerState::Disabled { connections, .. }
| PeerState::DisabledPendingEnable { connections, .. } => {
if let Some((_, connec_state)) =
connections.iter_mut().find(|(c, s)| {
*c == connection_id &&
matches!(s, ConnectionState::OpeningThenClosing)
*c == connection_id
&& matches!(s, ConnectionState::OpeningThenClosing)
}) {
*connec_state = ConnectionState::Closing;
} else {
@@ -2301,8 +2303,8 @@ impl NetworkBehaviour for Notifications {
NotificationCommand::SetHandshake(handshake) => {
self.set_notif_protocol_handshake(set_id.into(), handshake);
},
NotificationCommand::OpenSubstream(_peer) |
NotificationCommand::CloseSubstream(_peer) => {
NotificationCommand::OpenSubstream(_peer)
| NotificationCommand::CloseSubstream(_peer) => {
todo!("substream control not implemented");
},
},
@@ -2416,8 +2418,9 @@ mod tests {
(ConnectionState::Closing, ConnectionState::Closing) => true,
(ConnectionState::Opening, ConnectionState::Opening) => true,
(ConnectionState::OpeningThenClosing, ConnectionState::OpeningThenClosing) => true,
(ConnectionState::OpenDesiredByRemote, ConnectionState::OpenDesiredByRemote) =>
true,
(ConnectionState::OpenDesiredByRemote, ConnectionState::OpenDesiredByRemote) => {
true
},
(ConnectionState::Open(_), ConnectionState::Open(_)) => true,
_ => false,
}