crypto: Fix some clippy warnings

This commit is contained in:
Damir Jelić 2021-08-12 17:06:19 +02:00
parent f1da77fb6b
commit d0502c4f6b
3 changed files with 19 additions and 19 deletions

View File

@ -93,12 +93,12 @@ impl From<matrix_sdk_crypto::CrossSigningKeyExport> for CrossSigningKeyExport {
} }
} }
impl Into<matrix_sdk_crypto::CrossSigningKeyExport> for CrossSigningKeyExport { impl From<CrossSigningKeyExport> for matrix_sdk_crypto::CrossSigningKeyExport {
fn into(self) -> matrix_sdk_crypto::CrossSigningKeyExport { fn from(e: CrossSigningKeyExport) -> Self {
matrix_sdk_crypto::CrossSigningKeyExport { matrix_sdk_crypto::CrossSigningKeyExport {
master_key: self.master_key, master_key: e.master_key,
self_signing_key: self.self_signing_key, self_signing_key: e.self_signing_key,
user_signing_key: self.user_signing_key, user_signing_key: e.user_signing_key,
} }
} }
} }

View File

@ -287,7 +287,7 @@ impl OlmMachine {
) -> Result<(), CryptoStoreError> { ) -> Result<(), CryptoStoreError> {
let id = Uuid::parse_str(request_id).expect("Can't parse request id"); let id = Uuid::parse_str(request_id).expect("Can't parse request id");
let response = response_from_string(&response_body); let response = response_from_string(response_body);
let response: OwnedResponse = match request_type { let response: OwnedResponse = match request_type {
RequestType::KeysUpload => { RequestType::KeysUpload => {
@ -703,7 +703,7 @@ impl OlmMachine {
let user_id = UserId::try_from(user_id).ok()?; let user_id = UserId::try_from(user_id).ok()?;
let methods = methods let methods = methods
.into_iter() .into_iter()
.map(|m| VerificationMethod::from(m)) .map(VerificationMethod::from)
.collect(); .collect();
if let Some(verification) = self.inner.get_verification_request(&user_id, flow_id) { if let Some(verification) = self.inner.get_verification_request(&user_id, flow_id) {
@ -733,7 +733,7 @@ impl OlmMachine {
let methods = methods let methods = methods
.into_iter() .into_iter()
.map(|m| VerificationMethod::from(m)) .map(VerificationMethod::from)
.collect(); .collect();
Ok(if let Some(identity) = identity.and_then(|i| i.other()) { Ok(if let Some(identity) = identity.and_then(|i| i.other()) {
@ -781,7 +781,7 @@ impl OlmMachine {
let methods = methods let methods = methods
.into_iter() .into_iter()
.map(|m| VerificationMethod::from(m)) .map(VerificationMethod::from)
.collect(); .collect();
Ok(if let Some(identity) = identity.and_then(|i| i.other()) { Ok(if let Some(identity) = identity.and_then(|i| i.other()) {
@ -818,7 +818,7 @@ impl OlmMachine {
let methods = methods let methods = methods
.into_iter() .into_iter()
.map(|m| VerificationMethod::from(m)) .map(VerificationMethod::from)
.collect(); .collect();
Ok( Ok(
@ -856,7 +856,7 @@ impl OlmMachine {
let methods = methods let methods = methods
.into_iter() .into_iter()
.map(|m| VerificationMethod::from(m)) .map(VerificationMethod::from)
.collect(); .collect();
Ok(if let Some(identity) = identity.and_then(|i| i.own()) { Ok(if let Some(identity) = identity.and_then(|i| i.own()) {
@ -1025,7 +1025,7 @@ impl OlmMachine {
.get_verification(&user_id, flow_id) .get_verification(&user_id, flow_id)
.and_then(|v| { .and_then(|v| {
v.qr_v1() v.qr_v1()
.and_then(|qr| qr.to_bytes().map(|b| encode(b)).ok()) .and_then(|qr| qr.to_bytes().map(encode).ok())
}) })
} }

View File

@ -263,15 +263,15 @@ pub struct DeviceLists {
pub left: Vec<String>, pub left: Vec<String>,
} }
impl Into<RumaDeviceLists> for DeviceLists { impl From<DeviceLists> for RumaDeviceLists {
fn into(self) -> RumaDeviceLists { fn from(d: DeviceLists) -> Self {
assign!(RumaDeviceLists::new(), { assign!(RumaDeviceLists::new(), {
changed: self changed: d
.changed .changed
.into_iter() .into_iter()
.filter_map(|u| UserId::try_from(u).ok()) .filter_map(|u| UserId::try_from(u).ok())
.collect(), .collect(),
left: self left: d
.left .left
.into_iter() .into_iter()
.filter_map(|u| UserId::try_from(u).ok()) .filter_map(|u| UserId::try_from(u).ok())
@ -323,9 +323,9 @@ impl From<SignatureUploadResponse> for OwnedResponse {
} }
} }
impl<'a> Into<IncomingResponse<'a>> for &'a OwnedResponse { impl<'a> From<&'a OwnedResponse> for IncomingResponse<'a> {
fn into(self) -> IncomingResponse<'a> { fn from(r: &'a OwnedResponse) -> Self {
match self { match r {
OwnedResponse::KeysClaim(r) => IncomingResponse::KeysClaim(r), OwnedResponse::KeysClaim(r) => IncomingResponse::KeysClaim(r),
OwnedResponse::KeysQuery(r) => IncomingResponse::KeysQuery(r), OwnedResponse::KeysQuery(r) => IncomingResponse::KeysQuery(r),
OwnedResponse::KeysUpload(r) => IncomingResponse::KeysUpload(r), OwnedResponse::KeysUpload(r) => IncomingResponse::KeysUpload(r),