crypto: Fix a couple clippy warnings

master
Damir Jelić 2021-01-18 13:50:59 +01:00
parent 1746690eda
commit 436530e874
2 changed files with 4 additions and 3 deletions

View File

@ -395,7 +395,7 @@ pub(crate) mod test {
let user_id = Arc::new(user_id()); let user_id = Arc::new(user_id());
let account = ReadOnlyAccount::new(&user_id, &device_id()); let account = ReadOnlyAccount::new(&user_id, &device_id());
let store: Arc<Box<dyn CryptoStore>> = Arc::new(Box::new(MemoryStore::new())); let store: Arc<Box<dyn CryptoStore>> = Arc::new(Box::new(MemoryStore::new()));
let verification = VerificationMachine::new(account.clone(), identity.clone(), store); let verification = VerificationMachine::new(account, identity.clone(), store);
let store = Store::new( let store = Store::new(
user_id.clone(), user_id.clone(),
identity, identity,

View File

@ -127,6 +127,7 @@ impl GroupSessionManager {
room_id: &RoomId, room_id: &RoomId,
settings: EncryptionSettings, settings: EncryptionSettings,
) -> OlmResult<(OutboundGroupSession, Option<InboundGroupSession>)> { ) -> OlmResult<(OutboundGroupSession, Option<InboundGroupSession>)> {
#[allow(clippy::map_clone)]
if let Some(s) = self.outbound_group_sessions.get(room_id).map(|s| s.clone()) { if let Some(s) = self.outbound_group_sessions.get(room_id).map(|s| s.clone()) {
if s.expired() || s.invalidated() { if s.expired() || s.invalidated() {
self.create_outbound_group_session(room_id, settings) self.create_outbound_group_session(room_id, settings)
@ -189,10 +190,10 @@ impl GroupSessionManager {
let user_devices = self.store.get_user_devices(&user_id).await?; let user_devices = self.store.get_user_devices(&user_id).await?;
if !device_got_deleted { if !device_got_deleted {
let device_ids: HashSet<DeviceIdBox> = let device_ids: HashSet<DeviceIdBox> = user_devices.keys().cloned().collect();
user_devices.keys().map(|d| d.clone()).collect();
device_got_deleted = if let Some(shared) = outbound.shared_with_set.get(user_id) { device_got_deleted = if let Some(shared) = outbound.shared_with_set.get(user_id) {
#[allow(clippy::map_clone)]
let shared: HashSet<DeviceIdBox> = shared.iter().map(|d| d.clone()).collect(); let shared: HashSet<DeviceIdBox> = shared.iter().map(|d| d.clone()).collect();
!shared !shared
.difference(&device_ids) .difference(&device_ids)