From c7ee1ead0b843a68f3e61ef0e7af726740302ac4 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Tue, 11 Jul 2023 14:21:14 +1000 Subject: [PATCH] Fix clippy lints --- validator_client/src/http_api/test_utils.rs | 2 ++ validator_client/src/key_cache.rs | 6 ++++++ validator_manager/src/create_validators.rs | 2 +- validator_manager/src/move_validators.rs | 4 +++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/validator_client/src/http_api/test_utils.rs b/validator_client/src/http_api/test_utils.rs index d221de1425..a1bedb59bb 100644 --- a/validator_client/src/http_api/test_utils.rs +++ b/validator_client/src/http_api/test_utils.rs @@ -173,6 +173,7 @@ impl ApiTester { /// Checks that the key cache exists and can be decrypted with the current /// 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) { assert!( self.validator_dir.as_ref().join(CACHE_FILENAME).exists(), @@ -180,6 +181,7 @@ impl ApiTester { ); let key_cache = KeyCache::open_or_create(self.validator_dir.as_ref()).expect("should open a key cache"); + self.initialized_validators .read() .decrypt_key_cache(key_cache, &mut <_>::default(), OnDecryptFailure::Error) diff --git a/validator_client/src/key_cache.rs b/validator_client/src/key_cache.rs index b7abaaed06..c2dd7aa8fe 100644 --- a/validator_client/src/key_cache.rs +++ b/validator_client/src/key_cache.rs @@ -47,6 +47,12 @@ pub struct KeyCache { type SerializedKeyMap = HashMap; +impl Default for KeyCache { + fn default() -> Self { + Self::new() + } +} + impl KeyCache { pub fn new() -> Self { KeyCache { diff --git a/validator_manager/src/create_validators.rs b/validator_manager/src/create_validators.rs index ffa7b13a1c..e83a50d54e 100644 --- a/validator_manager/src/create_validators.rs +++ b/validator_manager/src/create_validators.rs @@ -863,7 +863,7 @@ pub mod tests { } }) .unwrap(); - let contents = fs::read_to_string(&path).unwrap(); + let contents = fs::read_to_string(path).unwrap(); serde_json::from_str(&contents).unwrap() }; diff --git a/validator_manager/src/move_validators.rs b/validator_manager/src/move_validators.rs index cacfbb5dc5..19074de5cc 100644 --- a/validator_manager/src/move_validators.rs +++ b/validator_manager/src/move_validators.rs @@ -639,6 +639,8 @@ mod test { const SRC_VC_TOKEN_FILE_NAME: &str = "src_vc_token.json"; const DEST_VC_TOKEN_FILE_NAME: &str = "dest_vc_token.json"; + type MutatePasswordFn = Box>)>; + struct TestBuilder { src_import_builder: Option, dest_import_builder: Option, @@ -646,7 +648,7 @@ mod test { dir: TempDir, move_back_again: bool, remove_passwords_from_src_vc: bool, - mutate_passwords: Option>)>>, + mutate_passwords: Option, passwords: HashMap>, }