matrix-sdk: Fix a bunch of clippy warnings.
parent
497b973eb5
commit
a2a87b9fff
|
@ -152,6 +152,12 @@ impl RoomBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for RoomBuilder {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<create_room::Request> for RoomBuilder {
|
||||
fn into(mut self) -> create_room::Request {
|
||||
self.req.creation_content = Some(self.creation_content);
|
||||
|
|
|
@ -374,12 +374,12 @@ impl Room {
|
|||
self.invited_members.remove(target_member);
|
||||
|
||||
self.joined_members
|
||||
.insert(target_member.clone(), new_member.clone())
|
||||
.insert(target_member.clone(), new_member)
|
||||
}
|
||||
|
||||
MembershipState::Invite => self
|
||||
.invited_members
|
||||
.insert(target_member.clone(), new_member.clone()),
|
||||
.insert(target_member.clone(), new_member),
|
||||
|
||||
_ => panic!("Room::add_member called on event that is neither `join` nor `invite`."),
|
||||
};
|
||||
|
@ -416,7 +416,7 @@ impl Room {
|
|||
|
||||
// Perform display name disambiguations, if necessary.
|
||||
let disambiguations =
|
||||
self.disambiguation_updates(target_member, leaving_member.display_name.clone(), None);
|
||||
self.disambiguation_updates(target_member, leaving_member.display_name, None);
|
||||
|
||||
debug!("remove_member: disambiguations: {:#?}", disambiguations);
|
||||
|
||||
|
@ -970,7 +970,7 @@ impl Room {
|
|||
}
|
||||
|
||||
let disambiguations =
|
||||
self.disambiguation_updates(target_member, old_name.clone(), new_name.clone());
|
||||
self.disambiguation_updates(target_member, old_name, new_name.clone());
|
||||
for (id, is_ambiguous) in disambiguations.iter() {
|
||||
if self.get_member_mut(id).is_none() {
|
||||
debug!("update_member_profile [{}]: Tried disambiguating display name for {} but he's not there",
|
||||
|
|
|
@ -143,9 +143,9 @@ impl RoomMember {
|
|||
/// `RoomMember::unique_name` in certain situations.
|
||||
pub fn disambiguated_name(&self) -> String {
|
||||
if self.display_name_ambiguous {
|
||||
self.unique_name().into()
|
||||
self.unique_name()
|
||||
} else {
|
||||
self.name().into()
|
||||
self.name()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,6 +98,7 @@ impl OlmMachine {
|
|||
/// * `user_id` - The unique id of the user that owns this machine.
|
||||
///
|
||||
/// * `device_id` - The unique id of the device that owns this machine.
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub fn new(user_id: &UserId, device_id: &DeviceId) -> Self {
|
||||
OlmMachine {
|
||||
user_id: user_id.clone(),
|
||||
|
|
|
@ -87,6 +87,7 @@ impl Account {
|
|||
];
|
||||
|
||||
/// Create a fresh new account, this will generate the identity key-pair.
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub fn new(user_id: &UserId, device_id: &DeviceId) -> Self {
|
||||
let account = OlmAccount::new();
|
||||
let identity_keys = account.parsed_identity_keys();
|
||||
|
@ -252,6 +253,7 @@ impl Account {
|
|||
///
|
||||
/// * `shared` - Boolean determining if the account was uploaded to the
|
||||
/// server.
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub fn from_pickle(
|
||||
pickle: String,
|
||||
pickle_mode: PicklingMode,
|
||||
|
@ -426,14 +428,12 @@ impl Account {
|
|||
device: Device,
|
||||
key_map: &BTreeMap<AlgorithmAndDeviceId, OneTimeKey>,
|
||||
) -> Result<Session, SessionCreationError> {
|
||||
let one_time_key =
|
||||
key_map
|
||||
.values()
|
||||
.next()
|
||||
.ok_or(SessionCreationError::OneTimeKeyMissing(
|
||||
let one_time_key = key_map.values().next().ok_or_else(|| {
|
||||
SessionCreationError::OneTimeKeyMissing(
|
||||
device.user_id().to_owned(),
|
||||
device.device_id().to_owned(),
|
||||
))?;
|
||||
)
|
||||
})?;
|
||||
|
||||
let one_time_key = match one_time_key {
|
||||
OneTimeKey::SignedKey(k) => k,
|
||||
|
@ -453,12 +453,12 @@ impl Account {
|
|||
)
|
||||
})?;
|
||||
|
||||
let curve_key = device.get_key(KeyAlgorithm::Curve25519).ok_or(
|
||||
let curve_key = device.get_key(KeyAlgorithm::Curve25519).ok_or_else(|| {
|
||||
SessionCreationError::DeviceMissingCurveKey(
|
||||
device.user_id().to_owned(),
|
||||
device.device_id().to_owned(),
|
||||
),
|
||||
)?;
|
||||
)
|
||||
})?;
|
||||
|
||||
self.create_outbound_session_helper(curve_key, &one_time_key)
|
||||
.await
|
||||
|
|
|
@ -87,7 +87,7 @@ pub enum CryptoStoreError {
|
|||
pub type Result<T> = std::result::Result<T, CryptoStoreError>;
|
||||
|
||||
#[async_trait]
|
||||
#[warn(clippy::type_complexity)]
|
||||
#[allow(clippy::type_complexity)]
|
||||
#[cfg_attr(not(target_arch = "wasm32"), send_sync)]
|
||||
/// Trait abstracting a store that the `OlmMachine` uses to store cryptographic
|
||||
/// keys.
|
||||
|
|
Loading…
Reference in New Issue