From 350276c08a5180be74e2572c9511f98e0d1fa370 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 2 Jan 2022 15:31:56 +0800 Subject: [PATCH] clean up more warnings and errors --- services/pddb/Cargo.toml | 2 +- services/pddb/src/backend/basis.rs | 2 ++ services/pddb/src/main.rs | 2 ++ services/pddb/src/tests.rs | 6 +++--- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/services/pddb/Cargo.toml b/services/pddb/Cargo.toml index dd31828b8..88230d755 100644 --- a/services/pddb/Cargo.toml +++ b/services/pddb/Cargo.toml @@ -59,4 +59,4 @@ mbbb = [] deterministic = [] # this flag adds CI tests to the build ci = [] -default = ["mbbb", "deterministic", "ci"] +default = ["mbbb"] diff --git a/services/pddb/src/backend/basis.rs b/services/pddb/src/backend/basis.rs index ebd24bd67..3f057d837 100644 --- a/services/pddb/src/backend/basis.rs +++ b/services/pddb/src/backend/basis.rs @@ -887,6 +887,7 @@ impl BasisCache { Ok(()) } + #[allow(dead_code)] pub(crate) fn basis_list(&self) -> Vec { let mut ret = Vec::new(); for bcache in &self.cache { @@ -913,6 +914,7 @@ impl BasisCache { /// note: you can "delete" a basis simply by forgetting its password, but this is more thorough. /// there might also need to be a variant to make which is a "change my password" function, but that is actually /// surprisingly hard. + #[allow(dead_code)] pub(crate) fn basis_delete(&mut self, hw: &mut PddbOs, mut basis: BasisCacheEntry) { let mut temp: [u8; PAGE_SIZE] = [0; PAGE_SIZE]; for page in basis.v2p_map.values_mut() { diff --git a/services/pddb/src/main.rs b/services/pddb/src/main.rs index 829ad9a70..3a8d32f09 100644 --- a/services/pddb/src/main.rs +++ b/services/pddb/src/main.rs @@ -410,6 +410,8 @@ fn xmain() -> ! { // OS-specific PDDB driver let mut pddb_os = PddbOs::new(Rc::clone(&entropy)); + + // run the CI tests if the option has been selected #[cfg(all( not(any(target_os = "none", target_os = "xous")), feature = "ci" diff --git a/services/pddb/src/tests.rs b/services/pddb/src/tests.rs index 0093123f4..db7b1c666 100644 --- a/services/pddb/src/tests.rs +++ b/services/pddb/src/tests.rs @@ -2,8 +2,8 @@ use rand::prelude::*; use rand_chacha::ChaCha8Rng; use crate::*; use core::sync::atomic::{AtomicU64, Ordering}; -use std::collections::BTreeSet; -use std::io::{Result, Error, ErrorKind}; +use std::collections::{BTreeSet, HashSet}; +use std::io::Result; const UPPER_BOUND: usize = 9000; const LOWER_BOUND: usize = 12; // needs to be big enough to compute murmur3 hash + hold checksum @@ -282,7 +282,7 @@ pub(crate) fn delete_pattern(hw: &mut PddbOs, basis_cache: &mut BasisCache, let (keyname, keydata) = gen_key(dictname, keynum, key_lower_bound, key_upper_bound); // now we're ready to write it out match basis_cache.key_attributes(hw, dictname, &keyname, None) { - Ok(ka) => { + Ok(_ka) => { log::warn!("rng collision on keygen: {}, deleting key", keyname); basis_cache.key_remove(hw, dictname, &keyname, None, false)?; }