Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rcmgleite committed Jul 8, 2024
1 parent 38de08f commit 224af42
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/cluster/heartbeat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async fn do_heartbeat_to_node(
);
}

return Err(err.into());
return Err(err);
}
}
};
Expand All @@ -125,7 +125,7 @@ async fn do_heartbeat_to_node(
event!(Level::WARN, "Unable to mark node as offline: {}", err);
}

Err(err.into())
Err(err)
} else {
event!(
Level::TRACE,
Expand Down
6 changes: 2 additions & 4 deletions src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,11 @@ impl Command {
Command::JoinCluster(cmd) => {
let request_id = cmd.request_id();
let payload = cmd.execute(db).await;
let res = Message::new(
Message::new(
CMD_CLUSTER_JOIN_CLUSTER,
request_id,
Self::serialize_response_payload(payload),
);

res
)
}
Command::ClusterState(cmd) => {
let request_id = cmd.request_id();
Expand Down
12 changes: 6 additions & 6 deletions src/cmd/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ impl From<String> for SerializedContext {
}
}

impl Into<String> for SerializedContext {
fn into(self) -> String {
self.0
impl From<SerializedContext> for String {
fn from(c: SerializedContext) -> Self {
c.0
}
}

Expand All @@ -66,9 +66,9 @@ impl Context {
}
}

impl Into<VersionVector> for Context {
fn into(self) -> VersionVector {
self.version
impl From<Context> for VersionVector {
fn from(c: Context) -> Self {
c.version
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/persistency/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,10 @@ impl Db {
Evaluation::Reached(value) => Ok(value),
Evaluation::NotReached => {
let failure_iter = quorum_result.failures.iter();
if failure_iter.size_hint().0 > 0 {
if quorum_result.failures.iter().all(|err| err.is_not_found()) {
return Err(Error::NotFound { key: key.clone() });
}
if failure_iter.size_hint().0 > 0
&& quorum_result.failures.iter().all(|err| err.is_not_found())
{
return Err(Error::NotFound { key: key.clone() });
}

Err(Error::QuorumNotReached {
Expand Down
2 changes: 1 addition & 1 deletion src/persistency/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub(crate) fn version_evaluation(
lhs: &VersionVector,
rhs: &VersionVector,
) -> Result<VersionEvaluation> {
match lhs.causality(&rhs) {
match lhs.causality(rhs) {
VersionVectorOrd::HappenedBefore | VersionVectorOrd::Equals => {
// the data we are trying to store is actually older than what's already stored.
// This can happen due to read repair and active anti-entropy processes for instance.
Expand Down

0 comments on commit 224af42

Please sign in to comment.