mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 22:04:44 +00:00
Rust 1.54.0 lints (#2483)
## Issue Addressed N/A ## Proposed Changes - Removing a bunch of unnecessary references - Updated `Error::VariantError` to `Error::Variant` - There were additional enum variant lints that I ignored, because I thought our variant names were fine - removed `MonitoredValidator`'s `pubkey` field, because I couldn't find it used anywhere. It looks like we just use the string version of the pubkey (the `id` field) if there is no index ## Additional Info Co-authored-by: realbigsean <seananderson33@gmail.com>
This commit is contained in:
@@ -778,7 +778,7 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
|
||||
) -> bool {
|
||||
{
|
||||
let mut peerdb = self.network_globals.peers.write();
|
||||
if peerdb.is_banned(&peer_id) {
|
||||
if peerdb.is_banned(peer_id) {
|
||||
// don't connect if the peer is banned
|
||||
slog::crit!(self.log, "Connection has been allowed to a banned peer"; "peer_id" => %peer_id);
|
||||
}
|
||||
@@ -952,7 +952,7 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
|
||||
/// previous bans from discovery.
|
||||
fn unban_peer(&mut self, peer_id: &PeerId) -> Result<(), &'static str> {
|
||||
let mut peer_db = self.network_globals.peers.write();
|
||||
peer_db.unban(&peer_id)?;
|
||||
peer_db.unban(peer_id)?;
|
||||
|
||||
let seen_ip_addresses = peer_db
|
||||
.peer_info(peer_id)
|
||||
|
||||
@@ -319,7 +319,7 @@ impl<TSpec: EthSpec> PeerDB<TSpec> {
|
||||
let mut by_status = self
|
||||
.peers
|
||||
.iter()
|
||||
.filter(|(_, info)| is_status(&info))
|
||||
.filter(|(_, info)| is_status(info))
|
||||
.collect::<Vec<_>>();
|
||||
by_status.sort_by_key(|(_, info)| info.score());
|
||||
by_status.into_iter().rev().collect()
|
||||
@@ -332,7 +332,7 @@ impl<TSpec: EthSpec> PeerDB<TSpec> {
|
||||
{
|
||||
self.peers
|
||||
.iter()
|
||||
.filter(|(_, info)| is_status(&info))
|
||||
.filter(|(_, info)| is_status(info))
|
||||
.max_by_key(|(_, info)| info.score())
|
||||
.map(|(id, _)| id)
|
||||
}
|
||||
@@ -1066,7 +1066,7 @@ mod tests {
|
||||
let mut socker_addr = Multiaddr::from(ip2);
|
||||
socker_addr.push(Protocol::Tcp(8080));
|
||||
for p in &peers {
|
||||
pdb.connect_ingoing(&p, socker_addr.clone(), None);
|
||||
pdb.connect_ingoing(p, socker_addr.clone(), None);
|
||||
pdb.disconnect_and_ban(p);
|
||||
pdb.inject_disconnect(p);
|
||||
pdb.disconnect_and_ban(p);
|
||||
@@ -1078,7 +1078,7 @@ mod tests {
|
||||
|
||||
// unban all peers
|
||||
for p in &peers {
|
||||
reset_score(&mut pdb, &p);
|
||||
reset_score(&mut pdb, p);
|
||||
pdb.unban(p).unwrap();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user