crypto: Remove some unnecessary mem::replace calls.
parent
21b33f4e61
commit
5175cd8ddb
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
use matrix_sdk_common::instant::Instant;
|
use matrix_sdk_common::instant::Instant;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
|
||||||
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
|
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
@ -275,7 +274,7 @@ impl Session {
|
||||||
/// * `message` - The Olm message that should be decrypted.
|
/// * `message` - The Olm message that should be decrypted.
|
||||||
pub async fn decrypt(&mut self, message: OlmMessage) -> Result<String, OlmSessionError> {
|
pub async fn decrypt(&mut self, message: OlmMessage) -> Result<String, OlmSessionError> {
|
||||||
let plaintext = self.inner.lock().await.decrypt(message)?;
|
let plaintext = self.inner.lock().await.decrypt(message)?;
|
||||||
mem::replace(&mut self.last_use_time, Arc::new(Instant::now()));
|
self.last_use_time = Arc::new(Instant::now());
|
||||||
Ok(plaintext)
|
Ok(plaintext)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +287,7 @@ impl Session {
|
||||||
/// * `plaintext` - The plaintext that should be encrypted.
|
/// * `plaintext` - The plaintext that should be encrypted.
|
||||||
pub async fn encrypt(&mut self, plaintext: &str) -> OlmMessage {
|
pub async fn encrypt(&mut self, plaintext: &str) -> OlmMessage {
|
||||||
let message = self.inner.lock().await.encrypt(plaintext);
|
let message = self.inner.lock().await.encrypt(plaintext);
|
||||||
mem::replace(&mut self.last_use_time, Arc::new(Instant::now()));
|
self.last_use_time = Arc::new(Instant::now());
|
||||||
message
|
message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
use matrix_sdk_common::instant::{Duration, Instant};
|
use matrix_sdk_common::instant::{Duration, Instant};
|
||||||
use std::collections::{BTreeMap, HashSet};
|
use std::collections::{BTreeMap, HashSet};
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::mem;
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::result::Result as StdResult;
|
use std::result::Result as StdResult;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -597,11 +596,11 @@ impl CryptoStore for SqliteStore {
|
||||||
.for_each(drop);
|
.for_each(drop);
|
||||||
|
|
||||||
let devices = self.load_devices().await?;
|
let devices = self.load_devices().await?;
|
||||||
mem::replace(&mut self.devices, devices);
|
self.devices = devices;
|
||||||
|
|
||||||
let (tracked_users, users_for_query) = self.load_tracked_users().await?;
|
let (tracked_users, users_for_query) = self.load_tracked_users().await?;
|
||||||
mem::replace(&mut self.tracked_users, tracked_users);
|
self.tracked_users = tracked_users;
|
||||||
mem::replace(&mut self.users_for_key_query, users_for_query);
|
self.users_for_key_query = users_for_query;
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue