Skip to content

Commit

Permalink
Warning cleanups for next version of rust (#601)
Browse files Browse the repository at this point in the history
Co-authored-by: Dan Laine <[email protected]>
  • Loading branch information
rkuris and Dan Laine authored Mar 20, 2024
1 parent e72ab0e commit 6d7e02e
Show file tree
Hide file tree
Showing 15 changed files with 10 additions and 22 deletions.
1 change: 1 addition & 0 deletions firewood/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ impl File {
filepath.push(fname);
Ok(std::fs::File::options()
.create(true)
.truncate(true)
.read(true)
.write(true)
.mode(0o600)
Expand Down
2 changes: 1 addition & 1 deletion firewood/src/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>, value: Vec<u8>) -> Node {
Expand Down
2 changes: 1 addition & 1 deletion firewood/src/merkle/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ impl Serialize for EncodedNode<Bincode> {
}

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();
Expand Down
4 changes: 2 additions & 2 deletions firewood/src/merkle/node/branch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ 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);
}
}
};
}

#[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)]
Expand Down
3 changes: 1 addition & 2 deletions firewood/src/merkle/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,6 @@ mod tests {
use crate::{merkle::Bincode, shale::cached::InMemLinearStore};

use super::*;
use futures::StreamExt;
use test_case::test_case;

impl<S: CachedStore, T> Merkle<S, T> {
Expand Down Expand Up @@ -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],
Expand Down
8 changes: 3 additions & 5 deletions firewood/src/shale/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ impl<T: Storable + Debug + 'static, M: CachedStore> CompactSpace<T, M> {
mod tests {
use sha3::Digest;

use crate::shale::{self, cached::InMemLinearStore, ObjCache};
use crate::shale::{self, cached::InMemLinearStore};

use super::*;

Expand Down Expand Up @@ -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!(
Expand Down
4 changes: 1 addition & 3 deletions firewood/src/storage/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
};
Expand Down
1 change: 0 additions & 1 deletion fwdctl/src/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use firewood::{
db::{Db, DbConfig, DbRevConfig, DiskBufferConfig, WalConfig},
v2::api,
};
use log;

#[derive(Args)]
pub struct Options {
Expand Down
1 change: 0 additions & 1 deletion fwdctl/src/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion fwdctl/src/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use firewood::{
v2::api::{self, Db as _},
};
use futures_util::StreamExt;
use log;
use std::borrow::Cow;

#[derive(Debug, Args)]
Expand Down
1 change: 0 additions & 1 deletion fwdctl/src/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use firewood::{
db::{Db, DbConfig, WalConfig},
v2::api::{self, Db as _, DbView},
};
use log;
use std::str;

#[derive(Debug, Args)]
Expand Down
1 change: 0 additions & 1 deletion fwdctl/src/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion fwdctl/src/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use firewood::{
db::{Db, DbConfig, WalConfig},
v2::api,
};
use log;
use std::str;

#[derive(Debug, Args)]
Expand Down
1 change: 0 additions & 1 deletion growth-ring/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion libaio/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit 6d7e02e

Please sign in to comment.