Skip to content

Commit

Permalink
feat: cargo clippy warning solved
Browse files Browse the repository at this point in the history
  • Loading branch information
devworlds authored and plebhash committed Dec 14, 2024
1 parent 2cd6e4c commit 0600602
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
26 changes: 13 additions & 13 deletions roles/jd-client/src/lib/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub enum Error<'a> {
Infallible(std::convert::Infallible),
}

impl<'a> fmt::Display for Error<'a> {
impl fmt::Display for Error<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use Error::*;
match self {
Expand All @@ -86,55 +86,55 @@ impl<'a> fmt::Display for Error<'a> {
}
}

impl<'a> From<binary_sv2::Error> for Error<'a> {
impl From<binary_sv2::Error> for Error<'_> {
fn from(e: binary_sv2::Error) -> Self {
Error::BinarySv2(e)
}
}

impl<'a> From<codec_sv2::noise_sv2::Error> for Error<'a> {
impl From<codec_sv2::noise_sv2::Error> for Error<'_> {
fn from(e: codec_sv2::noise_sv2::Error) -> Self {
Error::CodecNoise(e)
}
}

impl<'a> From<framing_sv2::Error> for Error<'a> {
impl From<framing_sv2::Error> for Error<'_> {
fn from(e: framing_sv2::Error) -> Self {
Error::FramingSv2(e)
}
}

impl<'a> From<std::io::Error> for Error<'a> {
impl From<std::io::Error> for Error<'_> {
fn from(e: std::io::Error) -> Self {
Error::Io(e)
}
}

impl<'a> From<std::num::ParseIntError> for Error<'a> {
impl From<std::num::ParseIntError> for Error<'_> {
fn from(e: std::num::ParseIntError) -> Self {
Error::ParseInt(e)
}
}

impl<'a> From<roles_logic_sv2::errors::Error> for Error<'a> {
impl From<roles_logic_sv2::errors::Error> for Error<'_> {
fn from(e: roles_logic_sv2::errors::Error) -> Self {
Error::RolesSv2Logic(e)
}
}

impl<'a> From<ConfigError> for Error<'a> {
impl From<ConfigError> for Error<'_> {
fn from(e: ConfigError) -> Self {
Error::BadConfigDeserialize(e)
}
}

impl<'a> From<async_channel::RecvError> for Error<'a> {
impl From<async_channel::RecvError> for Error<'_> {
fn from(e: async_channel::RecvError) -> Self {
Error::ChannelErrorReceiver(e)
}
}

impl<'a> From<tokio::sync::broadcast::error::RecvError> for Error<'a> {
impl From<tokio::sync::broadcast::error::RecvError> for Error<'_> {
fn from(e: tokio::sync::broadcast::error::RecvError) -> Self {
Error::TokioChannelErrorRecv(e)
}
Expand Down Expand Up @@ -176,7 +176,7 @@ impl<'a> From<async_channel::SendError<roles_logic_sv2::mining_sv2::SetNewPrevHa
}
}

impl<'a> From<async_channel::SendError<(ExtendedExtranonce, u32)>> for Error<'a> {
impl From<async_channel::SendError<(ExtendedExtranonce, u32)>> for Error<'_> {
fn from(e: async_channel::SendError<(ExtendedExtranonce, u32)>) -> Self {
Error::ChannelErrorSender(ChannelSendError::Extranonce(e))
}
Expand Down Expand Up @@ -212,13 +212,13 @@ impl<'a>
}
}

impl<'a> From<ParseLengthError> for Error<'a> {
impl From<ParseLengthError> for Error<'_> {
fn from(e: ParseLengthError) -> Self {
Error::Uint256Conversion(e)
}
}

impl<'a> From<std::convert::Infallible> for Error<'a> {
impl From<std::convert::Infallible> for Error<'_> {
fn from(e: std::convert::Infallible) -> Self {
Error::Infallible(e)
}
Expand Down
2 changes: 1 addition & 1 deletion roles/jd-client/src/lib/job_declarator/message_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl ParseServerJobDeclarationMessages for JobDeclarator {
None
}
})
.ok_or_else(|| Error::UnknownRequestId(message.request_id))?;
.ok_or(Error::UnknownRequestId(message.request_id))?;

Check warning on line 70 in roles/jd-client/src/lib/job_declarator/message_handler.rs

View check run for this annotation

Codecov / codecov/patch

roles/jd-client/src/lib/job_declarator/message_handler.rs#L70

Added line #L70 was not covered by tests

let unknown_tx_position_list: Vec<u16> = message.unknown_tx_position_list.into_inner();
let missing_transactions: Vec<binary_sv2::B016M> = unknown_tx_position_list
Expand Down
36 changes: 18 additions & 18 deletions roles/translator/src/lib/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub enum Error<'a> {
Sv1MessageTooLong,
}

impl<'a> fmt::Display for Error<'a> {
impl fmt::Display for Error<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use Error::*;
match self {
Expand Down Expand Up @@ -118,49 +118,49 @@ impl<'a> fmt::Display for Error<'a> {
}
}

impl<'a> From<binary_sv2::Error> for Error<'a> {
impl From<binary_sv2::Error> for Error<'_> {
fn from(e: binary_sv2::Error) -> Self {
Error::BinarySv2(e)
}
}

impl<'a> From<codec_sv2::noise_sv2::Error> for Error<'a> {
impl From<codec_sv2::noise_sv2::Error> for Error<'_> {
fn from(e: codec_sv2::noise_sv2::Error) -> Self {
Error::CodecNoise(e)
}
}

impl<'a> From<framing_sv2::Error> for Error<'a> {
impl From<framing_sv2::Error> for Error<'_> {
fn from(e: framing_sv2::Error) -> Self {
Error::FramingSv2(e)
}
}

impl<'a> From<std::io::Error> for Error<'a> {
impl From<std::io::Error> for Error<'_> {
fn from(e: std::io::Error) -> Self {
Error::Io(e)
}
}

impl<'a> From<std::num::ParseIntError> for Error<'a> {
impl From<std::num::ParseIntError> for Error<'_> {
fn from(e: std::num::ParseIntError) -> Self {
Error::ParseInt(e)
}
}

impl<'a> From<roles_logic_sv2::errors::Error> for Error<'a> {
impl From<roles_logic_sv2::errors::Error> for Error<'_> {
fn from(e: roles_logic_sv2::errors::Error) -> Self {
Error::RolesSv2Logic(e)
}
}

impl<'a> From<serde_json::Error> for Error<'a> {
impl From<serde_json::Error> for Error<'_> {
fn from(e: serde_json::Error) -> Self {
Error::BadSerdeJson(e)
}
}

impl<'a> From<ConfigError> for Error<'a> {
impl From<ConfigError> for Error<'_> {
fn from(e: ConfigError) -> Self {
Error::BadConfigDeserialize(e)
}
Expand All @@ -172,20 +172,20 @@ impl<'a> From<v1::error::Error<'a>> for Error<'a> {
}
}

impl<'a> From<async_channel::RecvError> for Error<'a> {
impl From<async_channel::RecvError> for Error<'_> {
fn from(e: async_channel::RecvError) -> Self {
Error::ChannelErrorReceiver(e)
}
}

impl<'a> From<tokio::sync::broadcast::error::RecvError> for Error<'a> {
impl From<tokio::sync::broadcast::error::RecvError> for Error<'_> {
fn from(e: tokio::sync::broadcast::error::RecvError) -> Self {
Error::TokioChannelErrorRecv(e)
}
}

//*** LOCK ERRORS ***
impl<'a, T> From<PoisonError<T>> for Error<'a> {
impl<T> From<PoisonError<T>> for Error<'_> {
fn from(_e: PoisonError<T>) -> Self {
Error::PoisonLock
}
Expand Down Expand Up @@ -216,13 +216,13 @@ impl<'a> From<tokio::sync::broadcast::error::SendError<Notify<'a>>> for Error<'a
}
}

impl<'a> From<async_channel::SendError<v1::Message>> for Error<'a> {
impl From<async_channel::SendError<v1::Message>> for Error<'_> {
fn from(e: async_channel::SendError<v1::Message>) -> Self {
Error::ChannelErrorSender(ChannelSendError::V1Message(e))
}
}

impl<'a> From<async_channel::SendError<(ExtendedExtranonce, u32)>> for Error<'a> {
impl From<async_channel::SendError<(ExtendedExtranonce, u32)>> for Error<'_> {
fn from(e: async_channel::SendError<(ExtendedExtranonce, u32)>) -> Self {
Error::ChannelErrorSender(ChannelSendError::Extranonce(e))
}
Expand Down Expand Up @@ -258,25 +258,25 @@ impl<'a>
}
}

impl<'a> From<Vec<u8>> for Error<'a> {
impl From<Vec<u8>> for Error<'_> {
fn from(e: Vec<u8>) -> Self {
Error::VecToSlice32(e)
}
}

impl<'a> From<ParseLengthError> for Error<'a> {
impl From<ParseLengthError> for Error<'_> {
fn from(e: ParseLengthError) -> Self {
Error::Uint256Conversion(e)
}
}

impl<'a> From<SetDifficulty> for Error<'a> {
impl From<SetDifficulty> for Error<'_> {
fn from(e: SetDifficulty) -> Self {
Error::SetDifficultyToMessage(e)
}
}

impl<'a> From<std::convert::Infallible> for Error<'a> {
impl From<std::convert::Infallible> for Error<'_> {
fn from(e: std::convert::Infallible) -> Self {
Error::Infallible(e)
}
Expand Down

0 comments on commit 0600602

Please sign in to comment.