diff --git a/firewood/src/merkle.rs b/firewood/src/merkle.rs index 8c3b0b5d6..8868560ed 100644 --- a/firewood/src/merkle.rs +++ b/firewood/src/merkle.rs @@ -1464,13 +1464,11 @@ pub const fn to_nibble_array(x: u8) -> [u8; 2] { pub fn from_nibbles(nibbles: &[u8]) -> impl Iterator + '_ { debug_assert_eq!(nibbles.len() & 1, 0); #[allow(clippy::indexing_slicing)] - #[allow(clippy::indexing_slicing)] nibbles.chunks_exact(2).map(|p| (p[0] << 4) | p[1]) } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[allow(clippy::indexing_slicing, clippy::unwrap_used)] mod tests { use crate::merkle::node::PlainCodec; diff --git a/firewood/src/merkle/node/branch.rs b/firewood/src/merkle/node/branch.rs index 145ddee09..19b15116f 100644 --- a/firewood/src/merkle/node/branch.rs +++ b/firewood/src/merkle/node/branch.rs @@ -182,8 +182,7 @@ impl BranchNode { #[allow(clippy::indexing_slicing)] if let Some(v) = &self.children_encoded[i] { if v.len() == TRIE_HASH_LEN { - #[allow(clippy::indexing_slicing)] - #[allow(clippy::unwrap_used)] + #[allow(clippy::indexing_slicing, clippy::unwrap_used)] (list[i] = Encoded::Data( bincode::DefaultOptions::new().serialize(v).unwrap(), )); diff --git a/firewood/src/merkle/proof.rs b/firewood/src/merkle/proof.rs index ad79a3297..a312ef0d8 100644 --- a/firewood/src/merkle/proof.rs +++ b/firewood/src/merkle/proof.rs @@ -158,7 +158,6 @@ impl + Send> Proof { // Ensure the received batch is monotonic increasing and contains no deletions #[allow(clippy::indexing_slicing)] - #[allow(clippy::indexing_slicing)] if !keys.windows(2).all(|w| w[0].as_ref() < w[1].as_ref()) { return Err(ProofError::NonMonotonicIncreaseRange); } @@ -631,10 +630,8 @@ fn unset_internal, S: ShaleStore + Send + Sync, T: BinarySe // If either the node pointed by left proof or right proof is nil, // stop here and the forkpoint is the fullnode. #[allow(clippy::indexing_slicing)] - #[allow(clippy::indexing_slicing)] let left_node = n.chd()[left_chunks[index] as usize]; #[allow(clippy::indexing_slicing)] - #[allow(clippy::indexing_slicing)] let right_node = n.chd()[right_chunks[index] as usize]; match (left_node.as_ref(), right_node.as_ref()) { @@ -704,17 +701,13 @@ fn unset_internal, S: ShaleStore + Send + Sync, T: BinarySe match &u_ref.inner() { NodeType::Branch(n) => { - #[allow(clippy::indexing_slicing)] #[allow(clippy::indexing_slicing)] let left_node = n.chd()[left_chunks[index] as usize]; #[allow(clippy::indexing_slicing)] - #[allow(clippy::indexing_slicing)] let right_node = n.chd()[right_chunks[index] as usize]; // unset all internal nodes calculated encoded value in the forkpoint - #[allow(clippy::unwrap_used)] - #[allow(clippy::indexing_slicing)] - #[allow(clippy::indexing_slicing)] + #[allow(clippy::indexing_slicing, clippy::unwrap_used)] for i in left_chunks[index] + 1..right_chunks[index] { u_ref .write(|u| { @@ -967,8 +960,7 @@ fn unset_node_ref, S: ShaleStore + Send + Sync, T: BinarySe (true, Ordering::Less) | (false, Ordering::Greater) ); - #[allow(clippy::unwrap_used)] - #[allow(clippy::indexing_slicing)] + #[allow(clippy::indexing_slicing, clippy::unwrap_used)] if should_unset_entire_branch { p_ref .write(|p| { diff --git a/firewood/src/merkle/stream.rs b/firewood/src/merkle/stream.rs index 9aca12ad4..c4faa0cf8 100644 --- a/firewood/src/merkle/stream.rs +++ b/firewood/src/merkle/stream.rs @@ -413,8 +413,7 @@ impl> IntoBytes for T {} use super::tests::create_test_merkle; #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[allow(clippy::indexing_slicing, clippy::unwrap_used)] mod tests { use crate::nibbles::Nibbles; diff --git a/firewood/src/merkle/trie_hash.rs b/firewood/src/merkle/trie_hash.rs index 3dff124d4..2f89105ea 100644 --- a/firewood/src/merkle/trie_hash.rs +++ b/firewood/src/merkle/trie_hash.rs @@ -28,8 +28,7 @@ impl Storable for TrieHash { offset: addr, size: U64_TRIE_HASH_LEN, })?; - #[allow(clippy::unwrap_used)] - #[allow(clippy::indexing_slicing)] + #[allow(clippy::indexing_slicing, clippy::unwrap_used)] Ok(Self(raw.as_deref()[..TRIE_HASH_LEN].try_into().unwrap())) } diff --git a/firewood/src/nibbles.rs b/firewood/src/nibbles.rs index 2649a771e..0f2138c39 100644 --- a/firewood/src/nibbles.rs +++ b/firewood/src/nibbles.rs @@ -48,12 +48,10 @@ impl<'a, const LEADING_ZEROES: usize> Index for Nibbles<'a, LEADING_ZEROE _ if index < LEADING_ZEROES => &NIBBLES[0], _ if (index - LEADING_ZEROES) % 2 == 0 => { - #[allow(clippy::indexing_slicing)] #[allow(clippy::indexing_slicing)] &NIBBLES[(self.0[(index - LEADING_ZEROES) / 2] >> 4) as usize] } #[allow(clippy::indexing_slicing)] - #[allow(clippy::indexing_slicing)] _ => &NIBBLES[(self.0[(index - LEADING_ZEROES) / 2] & 0xf) as usize], } } diff --git a/firewood/src/shale/cached.rs b/firewood/src/shale/cached.rs index 18ec3ecbf..94882e3bb 100644 --- a/firewood/src/shale/cached.rs +++ b/firewood/src/shale/cached.rs @@ -94,8 +94,7 @@ impl CachedView for PlainMemView { type DerefReturn = Vec; fn as_deref(&self) -> Self::DerefReturn { - #[allow(clippy::unwrap_used)] - #[allow(clippy::indexing_slicing)] + #[allow(clippy::indexing_slicing, clippy::unwrap_used)] self.mem.space.read().unwrap()[self.offset..self.offset + self.length].to_vec() } } @@ -195,15 +194,13 @@ impl CachedView for DynamicMemView { type DerefReturn = Vec; fn as_deref(&self) -> Self::DerefReturn { - #[allow(clippy::unwrap_used)] - #[allow(clippy::indexing_slicing)] + #[allow(clippy::indexing_slicing, clippy::unwrap_used)] self.mem.space.read().unwrap()[self.offset..self.offset + self.length].to_vec() } } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[allow(clippy::indexing_slicing, clippy::unwrap_used)] mod tests { use super::*; diff --git a/firewood/src/shale/compact.rs b/firewood/src/shale/compact.rs index 8fc1a02c3..619c5ad03 100644 --- a/firewood/src/shale/compact.rs +++ b/firewood/src/shale/compact.rs @@ -650,8 +650,7 @@ impl ShaleStore for Comp } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[allow(clippy::indexing_slicing, clippy::unwrap_used)] mod tests { use sha3::Digest; diff --git a/firewood/src/storage/buffer.rs b/firewood/src/storage/buffer.rs index 5a6e23323..c4ada6234 100644 --- a/firewood/src/storage/buffer.rs +++ b/firewood/src/storage/buffer.rs @@ -226,8 +226,7 @@ fn schedule_write( let offset = page_key.1 << PAGE_SIZE_NBIT; let fid = offset >> p.file_nbit; let fmask = (1 << p.file_nbit) - 1; - #[allow(clippy::unwrap_used)] - #[allow(clippy::indexing_slicing)] + #[allow(clippy::unwrap_used, clippy::indexing_slicing)] let file = file_pools.borrow()[page_key.0 as usize] .as_ref() .unwrap() @@ -302,8 +301,7 @@ async fn init_wal( for (undo, redo) in ash.iter() { let offset = undo.offset; let file_pools = file_pools.borrow(); - #[allow(clippy::unwrap_used)] - #[allow(clippy::indexing_slicing)] + #[allow(clippy::unwrap_used, clippy::indexing_slicing)] let file_pool = file_pools[space_id as usize].as_ref().unwrap(); let file_nbit = file_pool.get_file_nbit(); let file_mask = (1 << file_nbit) - 1; @@ -395,8 +393,7 @@ async fn run_wal_queue( false } Vacant(e) => { - #[allow(clippy::unwrap_used)] - #[allow(clippy::indexing_slicing)] + #[allow(clippy::unwrap_used, clippy::indexing_slicing)] let file_nbit = file_pools.borrow()[page_key.0 as usize] .as_ref() .unwrap() @@ -636,8 +633,7 @@ impl DiskBufferRequester { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[allow(clippy::unwrap_used, clippy::indexing_slicing)] mod tests { use sha3::Digest; use std::path::{Path, PathBuf}; diff --git a/firewood/src/storage/mod.rs b/firewood/src/storage/mod.rs index 24898b9be..7709208f3 100644 --- a/firewood/src/storage/mod.rs +++ b/firewood/src/storage/mod.rs @@ -150,8 +150,7 @@ impl StoreDelta { widx.sort_by_key(|i| writes[*i].offset); let mut witer = widx.into_iter(); - #[allow(clippy::unwrap_used)] - #[allow(clippy::indexing_slicing)] + #[allow(clippy::indexing_slicing, clippy::unwrap_used)] let w0 = &writes[witer.next().unwrap()]; let mut head = w0.offset >> PAGE_SIZE_NBIT; let mut tail = (w0.offset + w0.data.len() as u64 - 1) >> PAGE_SIZE_NBIT; @@ -213,7 +212,6 @@ impl StoreDelta { if !data.is_empty() { l += 1; #[allow(clippy::indexing_slicing)] - #[allow(clippy::indexing_slicing)] deltas[l].data_mut()[..data.len()].copy_from_slice(data); } } @@ -274,11 +272,8 @@ impl MemStoreR for StoreRev { #[allow(clippy::indexing_slicing)] data.extend(base_space.get_slice(start, delta[l].offset() - start)?); #[allow(clippy::indexing_slicing)] - #[allow(clippy::indexing_slicing)] data.extend(&delta[l].data()[..p_off as usize]); } else { - #[allow(clippy::indexing_slicing)] - #[allow(clippy::indexing_slicing)] #[allow(clippy::indexing_slicing)] data.extend(&delta[l].data()[(start - delta[l].offset()) as usize..p_off as usize]); }; @@ -298,8 +293,6 @@ impl MemStoreR for StoreRev { } #[allow(clippy::indexing_slicing)] if end < delta[l].offset() + PAGE_SIZE { - #[allow(clippy::indexing_slicing)] - #[allow(clippy::indexing_slicing)] #[allow(clippy::indexing_slicing)] data.extend(&delta[l].data()[..(end - delta[l].offset()) as usize]); break; @@ -655,8 +648,7 @@ impl MemStoreR for ZeroStore { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[allow(clippy::unwrap_used, clippy::indexing_slicing)] mod test { use super::*; #[test] diff --git a/firewood/tests/merkle.rs b/firewood/tests/merkle.rs index 2aebcddc1..62b1ad006 100644 --- a/firewood/tests/merkle.rs +++ b/firewood/tests/merkle.rs @@ -207,8 +207,7 @@ fn test_root_hash_random_deletions() -> Result<(), DataStoreError> { } #[test] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[allow(clippy::unwrap_used, clippy::indexing_slicing)] fn test_proof() -> Result<(), DataStoreError> { let set = generate_random_data(500); let mut items = Vec::from_iter(set.iter()); diff --git a/grpc-testtool/src/lib.rs b/grpc-testtool/src/lib.rs index 85ba10e8f..3819ac80a 100644 --- a/grpc-testtool/src/lib.rs +++ b/grpc-testtool/src/lib.rs @@ -2,20 +2,17 @@ // See the file LICENSE.md for licensing terms. pub mod sync { - #![allow(clippy::unwrap_used)] - #![allow(clippy::missing_const_for_fn)] + #![allow(clippy::unwrap_used, clippy::missing_const_for_fn)] tonic::include_proto!("sync"); } pub mod rpcdb { - #![allow(clippy::unwrap_used)] - #![allow(clippy::missing_const_for_fn)] + #![allow(clippy::unwrap_used, clippy::missing_const_for_fn)] tonic::include_proto!("rpcdb"); } pub mod process_server { - #![allow(clippy::unwrap_used)] - #![allow(clippy::missing_const_for_fn)] + #![allow(clippy::unwrap_used, clippy::missing_const_for_fn)] tonic::include_proto!("process"); }