Skip to content

Commit

Permalink
make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
XiangpengHao committed Jan 18, 2024
1 parent e6f03dd commit 6368008
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/base_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl BaseNode {
// crate::utils::fail_point(ArtError::Locked(version))?;

if Self::is_locked(version) || Self::is_obsolete(version) {
return Err(ArtError::Locked(version));
return Err(ArtError::Locked);
}

Ok(ReadGuard::new(version, self))
Expand Down
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::fmt::{self, Debug, Display, Formatter};

#[derive(Debug)]
pub(crate) enum ArtError {
VersionNotMatch(usize),
Locked(usize),
VersionNotMatch,
Locked,
Oom,
}

Expand Down
8 changes: 4 additions & 4 deletions src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl<'a, T: Node> ConcreteReadGuard<'a, T> {
Ok(_) => Ok(ConcreteWriteGuard {
node: unsafe { &mut *self.node.get() },
}),
Err(v) => Err((self, ArtError::VersionNotMatch(v))),
Err(_v) => Err((self, ArtError::VersionNotMatch)),
}
}
}
Expand Down Expand Up @@ -93,12 +93,12 @@ impl<'a> ReadGuard<'a> {
.load(Ordering::Acquire);

#[cfg(test)]
crate::utils::fail_point(ArtError::VersionNotMatch(v))?;
crate::utils::fail_point(ArtError::VersionNotMatch)?;

if v == self.version {
Ok(v)
} else {
Err(ArtError::VersionNotMatch(v))
Err(ArtError::VersionNotMatch)
}
}

Expand Down Expand Up @@ -142,7 +142,7 @@ impl<'a> ReadGuard<'a> {
Ok(_) => Ok(WriteGuard {
node: unsafe { &mut *self.node.get() },
}),
Err(v) => Err((self, ArtError::VersionNotMatch(v))),
Err(_v) => Err((self, ArtError::VersionNotMatch)),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl<T: RawKey, A: Allocator + Clone + Send> RawTree<T, A> {
match self.insert_inner(&k, &mut |_| tid, guard) {
Ok(v) => return Ok(v),
Err(e) => match e {
ArtError::Locked(_) | ArtError::VersionNotMatch(_) => {
ArtError::Locked | ArtError::VersionNotMatch => {
backoff.spin();
continue;
}
Expand All @@ -290,7 +290,7 @@ impl<T: RawKey, A: Allocator + Clone + Send> RawTree<T, A> {
match self.insert_inner(&k, insert_func, guard) {
Ok(v) => return Ok(v),
Err(e) => match e {
ArtError::Locked(_) | ArtError::VersionNotMatch(_) => {
ArtError::Locked | ArtError::VersionNotMatch => {
backoff.spin();
continue;
}
Expand Down

0 comments on commit 6368008

Please sign in to comment.