Update for clippy 1.50 (#2193)

## Issue Addressed

NA

## Proposed Changes

Rust 1.50 has landed 🎉

The shiny new `clippy` peers down upon us mere mortals with disgust. Brutish peasants wrapping our `usize`s in superfluous `Option`s... tsk tsk.

I've performed the goat sacrifice and corrected our evil ways in this PR. Tonight we shall pray that Github Actions bestows the almighty green tick upon us.

## Additional Info

NA


Co-authored-by: realbigsean <seananderson33@gmail.com>
Co-authored-by: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
Paul Hauner
2021-02-15 00:09:12 +00:00
parent e2ff9c66a1
commit 8e5c20b6d1
23 changed files with 84 additions and 57 deletions

View File

@@ -893,7 +893,7 @@ impl<TSpec: EthSpec> Behaviour<TSpec> {
}
// perform gossipsub score updates when necessary
while let Poll::Ready(_) = self.update_gossipsub_scores.poll_tick(cx) {
while self.update_gossipsub_scores.poll_tick(cx).is_ready() {
self.peer_manager.update_gossipsub_scores(&self.gossipsub);
}

View File

@@ -29,7 +29,7 @@ pub trait EnrExt {
/// Extend ENR CombinedPublicKey for libp2p types.
pub trait CombinedKeyPublicExt {
/// Converts the publickey into a peer id, without consuming the key.
fn into_peer_id(&self) -> PeerId;
fn as_peer_id(&self) -> PeerId;
}
/// Extend ENR CombinedKey for conversion to libp2p keys.
@@ -41,7 +41,7 @@ pub trait CombinedKeyExt {
impl EnrExt for Enr {
/// The libp2p `PeerId` for the record.
fn peer_id(&self) -> PeerId {
self.public_key().into_peer_id()
self.public_key().as_peer_id()
}
/// Returns a list of multiaddrs if the ENR has an `ip` and either a `tcp` or `udp` key **or** an `ip6` and either a `tcp6` or `udp6`.
@@ -195,7 +195,7 @@ impl CombinedKeyPublicExt for CombinedPublicKey {
/// Converts the publickey into a peer id, without consuming the key.
///
/// This is only available with the `libp2p` feature flag.
fn into_peer_id(&self) -> PeerId {
fn as_peer_id(&self) -> PeerId {
match self {
Self::Secp256k1(pk) => {
let pk_bytes = pk.to_bytes();

View File

@@ -972,7 +972,7 @@ impl<TSpec: EthSpec> Stream for PeerManager<TSpec> {
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
// perform the heartbeat when necessary
while let Poll::Ready(_) = self.heartbeat.poll_tick(cx) {
while self.heartbeat.poll_tick(cx).is_ready() {
self.heartbeat();
}

View File

@@ -240,7 +240,7 @@ impl Future for RPCRateLimiter {
type Output = ();
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
while let Poll::Ready(_) = self.prune_interval.poll_tick(cx) {
while self.prune_interval.poll_tick(cx).is_ready() {
self.prune();
}