Skip to content

Commit

Permalink
clippy::use_self
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersTrier committed Nov 22, 2024
1 parent e94ea0b commit 64b5019
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/engine/engine_avx2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl From<&Multiply128lutT> for LutAvx2 {
#[inline(always)]
fn from(lut: &Multiply128lutT) -> Self {
unsafe {
LutAvx2 {
Self {
t0_lo: _mm256_broadcastsi128_si256(_mm_loadu_si128(
std::ptr::from_ref::<u128>(&lut.lo[0]).cast::<__m128i>(),
)),
Expand Down
8 changes: 4 additions & 4 deletions src/engine/engine_default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ impl DefaultEngine {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
{
if is_x86_feature_detected!("avx2") {
return DefaultEngine(Box::new(Avx2::new()));
return Self(Box::new(Avx2::new()));
}

if is_x86_feature_detected!("ssse3") {
return DefaultEngine(Box::new(Ssse3::new()));
return Self(Box::new(Ssse3::new()));
}
}

#[cfg(target_arch = "aarch64")]
{
if std::arch::is_aarch64_feature_detected!("neon") {
return DefaultEngine(Box::new(Neon::new()));
return Self(Box::new(Neon::new()));
}
}

DefaultEngine(Box::new(NoSimd::new()))
Self(Box::new(NoSimd::new()))
}
}

Expand Down
20 changes: 10 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,22 +130,22 @@ pub enum Error {
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::DifferentShardSize { shard_bytes, got } => {
Self::DifferentShardSize { shard_bytes, got } => {
write!(
f,
"different shard size: expected {shard_bytes} bytes, got {got} bytes"
)
}

Error::DuplicateOriginalShardIndex { index } => {
Self::DuplicateOriginalShardIndex { index } => {
write!(f, "duplicate original shard index: {index}")
}

Error::DuplicateRecoveryShardIndex { index } => {
Self::DuplicateRecoveryShardIndex { index } => {
write!(f, "duplicate recovery shard index: {index}")
}

Error::InvalidOriginalShardIndex {
Self::InvalidOriginalShardIndex {
original_count,
index,
} => {
Expand All @@ -155,7 +155,7 @@ impl fmt::Display for Error {
)
}

Error::InvalidRecoveryShardIndex {
Self::InvalidRecoveryShardIndex {
recovery_count,
index,
} => {
Expand All @@ -165,14 +165,14 @@ impl fmt::Display for Error {
)
}

Error::InvalidShardSize { shard_bytes } => {
Self::InvalidShardSize { shard_bytes } => {
write!(
f,
"invalid shard size: {shard_bytes} bytes (must non-zero and multiple of 2)"
)
}

Error::NotEnoughShards {
Self::NotEnoughShards {
original_count,
original_received_count,
recovery_received_count,
Expand All @@ -183,7 +183,7 @@ impl fmt::Display for Error {
)
}

Error::TooFewOriginalShards {
Self::TooFewOriginalShards {
original_count,
original_received_count,
} => {
Expand All @@ -193,14 +193,14 @@ impl fmt::Display for Error {
)
}

Error::TooManyOriginalShards { original_count } => {
Self::TooManyOriginalShards { original_count } => {
write!(
f,
"too many original shards: got more than original_count ({original_count}) shards"
)
}

Error::UnsupportedShardCount {
Self::UnsupportedShardCount {
original_count,
recovery_count,
} => {
Expand Down

0 comments on commit 64b5019

Please sign in to comment.