diff --git a/firewood/src/file.rs b/firewood/src/file.rs index 0f9a7705b..e1d5e45e1 100644 --- a/firewood/src/file.rs +++ b/firewood/src/file.rs @@ -54,6 +54,7 @@ impl File { filepath.push(fname); Ok(std::fs::File::options() .create(true) + .truncate(true) .read(true) .write(true) .mode(0o600) diff --git a/firewood/src/merkle.rs b/firewood/src/merkle.rs index b02b51b0a..4ffdae5e8 100644 --- a/firewood/src/merkle.rs +++ b/firewood/src/merkle.rs @@ -1392,7 +1392,7 @@ impl<'a, T: PartialEq> PrefixOverlap<'a, T> { mod tests { use super::*; use crate::merkle::node::PlainCodec; - use shale::{cached::InMemLinearStore, CachedStore}; + use shale::cached::InMemLinearStore; use test_case::test_case; fn leaf(path: Vec, value: Vec) -> Node { diff --git a/firewood/src/merkle/node.rs b/firewood/src/merkle/node.rs index 2bf5636fb..b3ff322a7 100644 --- a/firewood/src/merkle/node.rs +++ b/firewood/src/merkle/node.rs @@ -570,7 +570,7 @@ impl Serialize for EncodedNode { } if let Some(val) = &self.value { - list[BranchNode::MAX_CHILDREN] = val.clone(); + list[BranchNode::MAX_CHILDREN].clone_from(val); } let serialized_path = nibbles_to_bytes_iter(&self.partial_path.encode()).collect(); diff --git a/firewood/src/merkle/node/branch.rs b/firewood/src/merkle/node/branch.rs index f511e87e8..5eeb71613 100644 --- a/firewood/src/merkle/node/branch.rs +++ b/firewood/src/merkle/node/branch.rs @@ -150,7 +150,7 @@ impl BranchNode { #[allow(clippy::indexing_slicing)] if let Some(v) = &self.children_encoded[i] { #[allow(clippy::indexing_slicing)] - (list[i] = v.clone()); + list[i].clone_from(v); } } }; @@ -158,7 +158,7 @@ impl BranchNode { #[allow(clippy::unwrap_used)] if let Some(val) = &self.value { - list[Self::MAX_CHILDREN] = val.clone(); + list[Self::MAX_CHILDREN].clone_from(val); } #[allow(clippy::unwrap_used)] diff --git a/firewood/src/merkle/stream.rs b/firewood/src/merkle/stream.rs index e8e3e16be..56939d0ec 100644 --- a/firewood/src/merkle/stream.rs +++ b/firewood/src/merkle/stream.rs @@ -585,7 +585,6 @@ mod tests { use crate::{merkle::Bincode, shale::cached::InMemLinearStore}; use super::*; - use futures::StreamExt; use test_case::test_case; impl Merkle { @@ -1102,7 +1101,7 @@ mod tests { assert!(first_key < intermediate); - let key_values = vec![ + let key_values = [ vec![first_key], vec![intermediate, intermediate], vec![intermediate, intermediate, intermediate], diff --git a/firewood/src/shale/compact.rs b/firewood/src/shale/compact.rs index ad3eceb40..463209ad5 100644 --- a/firewood/src/shale/compact.rs +++ b/firewood/src/shale/compact.rs @@ -691,7 +691,7 @@ impl CompactSpace { mod tests { use sha3::Digest; - use crate::shale::{self, cached::InMemLinearStore, ObjCache}; + use crate::shale::{self, cached::InMemLinearStore}; use super::*; @@ -787,15 +787,13 @@ mod tests { .cache .lock() .pinned - .get(&DiskAddress::from(4113)) - .is_some()); + .contains_key(&DiskAddress::from(4113))); // dirty assert!(obj_ref .cache .lock() .dirty - .get(&DiskAddress::from(4113)) - .is_some()); + .contains(&DiskAddress::from(4113))); drop(obj_ref); // write is visible assert_eq!( diff --git a/firewood/src/storage/buffer.rs b/firewood/src/storage/buffer.rs index 75111f3ba..92c4bbb41 100644 --- a/firewood/src/storage/buffer.rs +++ b/firewood/src/storage/buffer.rs @@ -638,15 +638,13 @@ impl DiskBufferRequester { #[allow(clippy::unwrap_used, clippy::indexing_slicing)] mod tests { use sha3::Digest; - use std::path::{Path, PathBuf}; - use tokio::task::block_in_place; use super::*; use crate::shale::CachedStore; use crate::{ file, storage::{ - Ash, CachedSpace, DeltaPage, MemStoreR, StoreConfig, StoreRevMut, StoreRevMutDelta, + Ash, CachedSpace, MemStoreR, StoreConfig, StoreRevMut, StoreRevMutDelta, StoreRevShared, ZeroStore, }, }; diff --git a/fwdctl/src/create.rs b/fwdctl/src/create.rs index 51d3ed251..a1984f7af 100644 --- a/fwdctl/src/create.rs +++ b/fwdctl/src/create.rs @@ -6,7 +6,6 @@ use firewood::{ db::{Db, DbConfig, DbRevConfig, DiskBufferConfig, WalConfig}, v2::api, }; -use log; #[derive(Args)] pub struct Options { diff --git a/fwdctl/src/delete.rs b/fwdctl/src/delete.rs index c47f5a9b4..d16caa337 100644 --- a/fwdctl/src/delete.rs +++ b/fwdctl/src/delete.rs @@ -8,7 +8,6 @@ use firewood::{ db::{BatchOp, Db, DbConfig, WalConfig}, v2::api::{self, Db as _, Proposal}, }; -use log; #[derive(Debug, Args)] pub struct Options { diff --git a/fwdctl/src/dump.rs b/fwdctl/src/dump.rs index 928574b4b..be601e146 100644 --- a/fwdctl/src/dump.rs +++ b/fwdctl/src/dump.rs @@ -8,7 +8,6 @@ use firewood::{ v2::api::{self, Db as _}, }; use futures_util::StreamExt; -use log; use std::borrow::Cow; #[derive(Debug, Args)] diff --git a/fwdctl/src/get.rs b/fwdctl/src/get.rs index a94c437d1..c43fca80c 100644 --- a/fwdctl/src/get.rs +++ b/fwdctl/src/get.rs @@ -6,7 +6,6 @@ use firewood::{ db::{Db, DbConfig, WalConfig}, v2::api::{self, Db as _, DbView}, }; -use log; use std::str; #[derive(Debug, Args)] diff --git a/fwdctl/src/insert.rs b/fwdctl/src/insert.rs index 8cb56b8f7..09959a939 100644 --- a/fwdctl/src/insert.rs +++ b/fwdctl/src/insert.rs @@ -8,7 +8,6 @@ use firewood::{ db::{BatchOp, Db, DbConfig, WalConfig}, v2::api::{self, Db as _, Proposal}, }; -use log; #[derive(Debug, Args)] pub struct Options { diff --git a/fwdctl/src/root.rs b/fwdctl/src/root.rs index 973d44616..ec4da10a1 100644 --- a/fwdctl/src/root.rs +++ b/fwdctl/src/root.rs @@ -7,7 +7,6 @@ use firewood::{ db::{Db, DbConfig, WalConfig}, v2::api, }; -use log; use std::str; #[derive(Debug, Args)] diff --git a/growth-ring/tests/common/mod.rs b/growth-ring/tests/common/mod.rs index e601d5b85..152351b7d 100644 --- a/growth-ring/tests/common/mod.rs +++ b/growth-ring/tests/common/mod.rs @@ -11,7 +11,6 @@ use rand::Rng; use std::cell::RefCell; use std::collections::VecDeque; use std::collections::{hash_map, HashMap}; -use std::convert::TryInto; use std::path::PathBuf; use std::rc::Rc; diff --git a/libaio/src/abi.rs b/libaio/src/abi.rs index b4784bd5c..9d6fe58cb 100644 --- a/libaio/src/abi.rs +++ b/libaio/src/abi.rs @@ -7,7 +7,6 @@ pub use libc::timespec; use libc::{c_int, c_long, size_t}; -use std::default::Default; use std::mem::zeroed; #[repr(C)]