mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
Fix clippy lints
This commit is contained in:
@@ -173,6 +173,7 @@ impl ApiTester {
|
|||||||
|
|
||||||
/// Checks that the key cache exists and can be decrypted with the current
|
/// Checks that the key cache exists and can be decrypted with the current
|
||||||
/// set of known validators.
|
/// set of known validators.
|
||||||
|
#[allow(clippy::await_holding_lock)] // This is a test, so it should be fine.
|
||||||
pub async fn ensure_key_cache_consistency(&self) {
|
pub async fn ensure_key_cache_consistency(&self) {
|
||||||
assert!(
|
assert!(
|
||||||
self.validator_dir.as_ref().join(CACHE_FILENAME).exists(),
|
self.validator_dir.as_ref().join(CACHE_FILENAME).exists(),
|
||||||
@@ -180,6 +181,7 @@ impl ApiTester {
|
|||||||
);
|
);
|
||||||
let key_cache =
|
let key_cache =
|
||||||
KeyCache::open_or_create(self.validator_dir.as_ref()).expect("should open a key cache");
|
KeyCache::open_or_create(self.validator_dir.as_ref()).expect("should open a key cache");
|
||||||
|
|
||||||
self.initialized_validators
|
self.initialized_validators
|
||||||
.read()
|
.read()
|
||||||
.decrypt_key_cache(key_cache, &mut <_>::default(), OnDecryptFailure::Error)
|
.decrypt_key_cache(key_cache, &mut <_>::default(), OnDecryptFailure::Error)
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ pub struct KeyCache {
|
|||||||
|
|
||||||
type SerializedKeyMap = HashMap<Uuid, ZeroizeHash>;
|
type SerializedKeyMap = HashMap<Uuid, ZeroizeHash>;
|
||||||
|
|
||||||
|
impl Default for KeyCache {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl KeyCache {
|
impl KeyCache {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
KeyCache {
|
KeyCache {
|
||||||
|
|||||||
@@ -863,7 +863,7 @@ pub mod tests {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let contents = fs::read_to_string(&path).unwrap();
|
let contents = fs::read_to_string(path).unwrap();
|
||||||
serde_json::from_str(&contents).unwrap()
|
serde_json::from_str(&contents).unwrap()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -639,6 +639,8 @@ mod test {
|
|||||||
const SRC_VC_TOKEN_FILE_NAME: &str = "src_vc_token.json";
|
const SRC_VC_TOKEN_FILE_NAME: &str = "src_vc_token.json";
|
||||||
const DEST_VC_TOKEN_FILE_NAME: &str = "dest_vc_token.json";
|
const DEST_VC_TOKEN_FILE_NAME: &str = "dest_vc_token.json";
|
||||||
|
|
||||||
|
type MutatePasswordFn = Box<dyn Fn(&mut HashMap<PublicKeyBytes, Vec<String>>)>;
|
||||||
|
|
||||||
struct TestBuilder {
|
struct TestBuilder {
|
||||||
src_import_builder: Option<ImportTestBuilder>,
|
src_import_builder: Option<ImportTestBuilder>,
|
||||||
dest_import_builder: Option<ImportTestBuilder>,
|
dest_import_builder: Option<ImportTestBuilder>,
|
||||||
@@ -646,7 +648,7 @@ mod test {
|
|||||||
dir: TempDir,
|
dir: TempDir,
|
||||||
move_back_again: bool,
|
move_back_again: bool,
|
||||||
remove_passwords_from_src_vc: bool,
|
remove_passwords_from_src_vc: bool,
|
||||||
mutate_passwords: Option<Box<dyn Fn(&mut HashMap<PublicKeyBytes, Vec<String>>)>>,
|
mutate_passwords: Option<MutatePasswordFn>,
|
||||||
passwords: HashMap<PublicKeyBytes, Vec<String>>,
|
passwords: HashMap<PublicKeyBytes, Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user