Fix Rust 1.83 Clippy lints (#6629)

* Fix Rust 1.83 Clippy lints

* Cargo fmt
This commit is contained in:
Michael Sproul
2024-11-29 13:23:54 +11:00
committed by GitHub
parent 38f5f665e1
commit fa6c4c02a3
35 changed files with 73 additions and 77 deletions

View File

@@ -48,8 +48,7 @@ pub(crate) struct BackoffStorage {
impl BackoffStorage {
fn heartbeats(d: &Duration, heartbeat_interval: &Duration) -> usize {
((d.as_nanos() + heartbeat_interval.as_nanos() - 1) / heartbeat_interval.as_nanos())
as usize
d.as_nanos().div_ceil(heartbeat_interval.as_nanos()) as usize
}
pub(crate) fn new(

View File

@@ -63,7 +63,7 @@ impl<'de> Deserialize<'de> for PeerIdSerialized {
// A wrapper struct that prints a dial error nicely.
struct ClearDialError<'a>(&'a DialError);
impl<'a> ClearDialError<'a> {
impl ClearDialError<'_> {
fn most_inner_error(err: &(dyn std::error::Error)) -> &(dyn std::error::Error) {
let mut current = err;
while let Some(source) = current.source() {
@@ -73,7 +73,7 @@ impl<'a> ClearDialError<'a> {
}
}
impl<'a> std::fmt::Display for ClearDialError<'a> {
impl std::fmt::Display for ClearDialError<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
match &self.0 {
DialError::Transport(errors) => {