fix(crypto): Fix some clippy warnings

master
Damir Jelić 2021-09-13 10:18:23 +02:00
parent a6916dd9dd
commit b8001b78b4
6 changed files with 7 additions and 20 deletions

View File

@ -42,7 +42,7 @@ use super::{atomic_bool_deserializer, atomic_bool_serializer};
use crate::{
error::{EventError, OlmError, OlmResult, SignatureError},
identities::{ReadOnlyOwnUserIdentity, ReadOnlyUserIdentities},
olm::{InboundGroupSession, PrivateCrossSigningIdentity, Session, Utility},
olm::{InboundGroupSession, Session, Utility},
store::{Changes, CryptoStore, DeviceChanges, Result as StoreResult},
verification::VerificationMachine,
OutgoingVerificationRequest, Sas, ToDeviceRequest, VerificationRequest,
@ -296,7 +296,6 @@ impl Device {
#[derive(Debug)]
pub struct UserDevices {
pub(crate) inner: HashMap<DeviceIdBox, ReadOnlyDevice>,
pub(crate) private_identity: Arc<Mutex<PrivateCrossSigningIdentity>>,
pub(crate) verification_machine: VerificationMachine,
pub(crate) own_identity: Option<ReadOnlyOwnUserIdentity>,
pub(crate) device_owner_identity: Option<ReadOnlyUserIdentities>,

View File

@ -309,7 +309,6 @@ impl Store {
Ok(UserDevices {
inner: devices,
private_identity: self.identity.clone(),
verification_machine: self.verification_machine.clone(),
own_identity,
device_owner_identity,

View File

@ -164,7 +164,6 @@ pub struct SledStore {
identities: Tree,
tracked_users: Tree,
users_for_key_query: Tree,
}
impl std::fmt::Debug for SledStore {
@ -246,7 +245,6 @@ impl SledStore {
let outbound_group_sessions = db.open_tree("outbound_group_sessions")?;
let tracked_users = db.open_tree("tracked_users")?;
let users_for_key_query = db.open_tree("users_for_key_query")?;
let olm_hashes = db.open_tree("olm_hashes")?;
let devices = db.open_tree("devices")?;
@ -283,7 +281,6 @@ impl SledStore {
secret_requests_by_info,
devices,
tracked_users,
users_for_key_query,
olm_hashes,
identities,
})

View File

@ -80,7 +80,6 @@ pub enum ScanError {
#[derive(Clone)]
pub struct QrVerification {
flow_id: FlowId,
store: VerificationStore,
inner: Arc<QrVerificationData>,
state: Arc<Mutex<InnerState>>,
identities: IdentitiesBeingVerified,
@ -429,7 +428,6 @@ impl QrVerification {
}
pub(crate) fn new_self(
store: VerificationStore,
flow_id: FlowId,
own_master_key: String,
other_device_key: String,
@ -447,7 +445,7 @@ impl QrVerification {
)
.into();
Self::new_helper(store, flow_id, inner, identities, we_started, request_handle)
Self::new_helper(flow_id, inner, identities, we_started, request_handle)
}
pub(crate) fn new_self_no_master(
@ -468,11 +466,10 @@ impl QrVerification {
)
.into();
Self::new_helper(store, flow_id, inner, identities, we_started, request_handle)
Self::new_helper(flow_id, inner, identities, we_started, request_handle)
}
pub(crate) fn new_cross(
store: VerificationStore,
flow_id: FlowId,
own_master_key: String,
other_master_key: String,
@ -491,7 +488,7 @@ impl QrVerification {
let inner: QrVerificationData =
VerificationData::new(event_id, own_master_key, other_master_key, secret).into();
Self::new_helper(store, flow_id, inner, identities, we_started, request_handle)
Self::new_helper(flow_id, inner, identities, we_started, request_handle)
}
#[allow(clippy::too_many_arguments)]
@ -585,7 +582,6 @@ impl QrVerification {
let own_device_id = store.account.device_id().to_owned();
Ok(Self {
store,
flow_id,
inner: qr_code.into(),
state: Mutex::new(InnerState::Reciprocated(QrState {
@ -599,7 +595,6 @@ impl QrVerification {
}
fn new_helper(
store: VerificationStore,
flow_id: FlowId,
inner: QrVerificationData,
identities: IdentitiesBeingVerified,
@ -609,7 +604,6 @@ impl QrVerification {
let secret = inner.secret().to_owned();
Self {
store,
flow_id,
inner: inner.into(),
state: Mutex::new(InnerState::Created(QrState { state: Created { secret } })).into(),
@ -851,7 +845,6 @@ mod test {
assert_eq!(verification.inner.second_key(), &master_key);
let verification = QrVerification::new_self(
store.clone(),
flow_id,
master_key.clone(),
device_key.clone(),
@ -870,7 +863,6 @@ mod test {
let flow_id = FlowId::InRoom(room_id!("!test:example"), event_id!("$EVENTID"));
let verification = QrVerification::new_cross(
store.clone(),
flow_id,
master_key.clone(),
bob_master_key.clone(),
@ -972,6 +964,7 @@ mod test {
assert!(bob_verification.is_done());
let identity = alice_verification
.identities
.store
.get_user_identity(alice_account.user_id())
.await

View File

@ -999,7 +999,6 @@ impl RequestState<Ready> {
identites.other_device().get_key(DeviceKeyAlgorithm::Ed25519)
{
Some(QrVerification::new_self(
self.store.clone(),
self.flow_id.as_ref().to_owned(),
master_key.to_owned(),
device_key.to_owned(),
@ -1048,7 +1047,6 @@ impl RequestState<Ready> {
.and_then(|m| m.get_first_key().map(|m| m.to_owned()))
{
Some(QrVerification::new_cross(
self.store.clone(),
self.flow_id.as_ref().to_owned(),
own_master,
other_master.to_owned(),
@ -1251,6 +1249,7 @@ impl RequestState<Ready> {
#[derive(Clone, Debug)]
struct Passive {
/// The device id of the device that responded to the verification request.
#[allow(dead_code)]
pub other_device_id: DeviceIdBox,
}

View File

@ -665,7 +665,7 @@ impl SasState<WeAccepted> {
last_event_time: Instant::now().into(),
started_from_request: self.started_from_request,
state: Arc::new(KeyReceived {
we_started: false,
we_started: self.state.we_started,
their_pubkey,
accepted_protocols: self.state.accepted_protocols.clone(),
}),