Skip to content

Commit

Permalink
fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmlm committed Oct 10, 2023
1 parent 50a45dc commit 4b11dd1
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vsdb_core"
version = "0.61.0"
version = "0.61.1"
authors = ["hui.fan@mail.ru"]
edition = "2021"
description = "A stuctured DB with some 'Git-like' features, mainly used in blockchain projects."
Expand Down
5 changes: 1 addition & 4 deletions core/src/versioned/mapx_raw/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ impl From<MapxRawVsWithoutDerivedFields> for MapxRawVs {
.iter()
.fold(existing_vers, |mut acc, (k, vers)| {
for (ver, _) in decode_map(vers).iter() {
acc.entry(to_verid(&ver))
.or_insert_with(BTreeSet::new)
.insert(k.clone());
acc.entry(to_verid(&ver)).or_default().insert(k.clone());
}
acc
});
Expand Down Expand Up @@ -1069,7 +1067,6 @@ impl MapxRawVs {
.filter(|brid| !br_ids.contains(brid))
.copied()
.collect::<Vec<_>>();
let brs = brs;
for brid in brs.into_iter() {
self.branch_remove(brid).c(d!())?;
}
Expand Down
2 changes: 1 addition & 1 deletion utils/slot_db/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vsdb_slot_db"
version = "0.8.0"
version = "0.8.1"
edition = "2021"
keywords = ["index", "cache", "timestamp", "slot", "database"]
license = "MIT"
Expand Down
14 changes: 7 additions & 7 deletions utils/slot_db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,8 @@ where
self.levels.push(newtop);
};

if self
.data
.entry(&slot)
.or_insert(DataCtner::default())
.insert(t)
{
#[allow(clippy::unwrap_or_default)]
if self.data.entry(&slot).or_insert(DataCtner::new()).insert(t) {
self.levels.iter_mut().for_each(|l| {
let slot_floor = slot / l.floor_base * l.floor_base;
*l.data.entry(&slot_floor).or_insert(0) += 1;
Expand Down Expand Up @@ -464,6 +460,10 @@ impl<T> DataCtner<T>
where
T: Clone + Ord + KeyEnDeOrdered + Serialize + de::DeserializeOwned,
{
fn new() -> Self {
Self::Small(BTreeSet::new())
}

fn len(&self) -> usize {
match self {
Self::Small(i) => i.len(),
Expand Down Expand Up @@ -514,7 +514,7 @@ where
T: Clone + Ord + KeyEnDeOrdered + Serialize + de::DeserializeOwned,
{
fn default() -> Self {
Self::Small(BTreeSet::new())
Self::new()
}
}

Expand Down
2 changes: 1 addition & 1 deletion wrappers/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vsdb"
version = "0.61.0"
version = "0.61.1"
authors = ["hui.fan@mail.ru"]
edition = "2021"
description = "A stuctured DB with some 'Git-like' features, mainly used in blockchain projects."
Expand Down
2 changes: 1 addition & 1 deletion wrappers/src/basic/orphan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ where
T: ValueEnDe + Ord,
{
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.get_value().partial_cmp(&other.get_value())
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion wrappers/src/versioned_multi_key/mapx_raw/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ impl From<MapxRawMkVsWithoutDerivedFields> for MapxRawMkVs {
let mut op = |k: &[&[u8]], v: &[u8]| {
let k = to_owned_key(k);
let v = v.to_vec();
#[allow(clippy::unwrap_or_default)]
acc.entry(k).or_insert_with(BTreeMap::new).insert(ver, v);
Ok(())
};
Expand Down Expand Up @@ -1004,7 +1005,6 @@ impl MapxRawMkVs {
.filter(|brid| !br_ids.contains(brid))
.copied()
.collect::<Vec<_>>();
let brs = brs; // avoid warnings
for brid in brs.into_iter() {
self.branch_remove(brid).c(d!())?;
}
Expand Down

0 comments on commit 4b11dd1

Please sign in to comment.