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 {
fn into(self) -> matrix_sdk_crypto::CrossSigningKeyExport {
impl From<CrossSigningKeyExport> for matrix_sdk_crypto::CrossSigningKeyExport {
fn from(e: CrossSigningKeyExport) -> Self {
matrix_sdk_crypto::CrossSigningKeyExport {
master_key: self.master_key,
self_signing_key: self.self_signing_key,
user_signing_key: self.user_signing_key,
master_key: e.master_key,
self_signing_key: e.self_signing_key,
user_signing_key: e.user_signing_key,
}
}
}

View File

@ -287,7 +287,7 @@ impl OlmMachine {
) -> Result<(), CryptoStoreError> {
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 {
RequestType::KeysUpload => {
@ -703,7 +703,7 @@ impl OlmMachine {
let user_id = UserId::try_from(user_id).ok()?;
let methods = methods
.into_iter()
.map(|m| VerificationMethod::from(m))
.map(VerificationMethod::from)
.collect();
if let Some(verification) = self.inner.get_verification_request(&user_id, flow_id) {
@ -733,7 +733,7 @@ impl OlmMachine {
let methods = methods
.into_iter()
.map(|m| VerificationMethod::from(m))
.map(VerificationMethod::from)
.collect();
Ok(if let Some(identity) = identity.and_then(|i| i.other()) {
@ -781,7 +781,7 @@ impl OlmMachine {
let methods = methods
.into_iter()
.map(|m| VerificationMethod::from(m))
.map(VerificationMethod::from)
.collect();
Ok(if let Some(identity) = identity.and_then(|i| i.other()) {
@ -818,7 +818,7 @@ impl OlmMachine {
let methods = methods
.into_iter()
.map(|m| VerificationMethod::from(m))
.map(VerificationMethod::from)
.collect();
Ok(
@ -856,7 +856,7 @@ impl OlmMachine {
let methods = methods
.into_iter()
.map(|m| VerificationMethod::from(m))
.map(VerificationMethod::from)
.collect();
Ok(if let Some(identity) = identity.and_then(|i| i.own()) {
@ -1025,7 +1025,7 @@ impl OlmMachine {
.get_verification(&user_id, flow_id)
.and_then(|v| {
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>,
}
impl Into<RumaDeviceLists> for DeviceLists {
fn into(self) -> RumaDeviceLists {
impl From<DeviceLists> for RumaDeviceLists {
fn from(d: DeviceLists) -> Self {
assign!(RumaDeviceLists::new(), {
changed: self
changed: d
.changed
.into_iter()
.filter_map(|u| UserId::try_from(u).ok())
.collect(),
left: self
left: d
.left
.into_iter()
.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 {
fn into(self) -> IncomingResponse<'a> {
match self {
impl<'a> From<&'a OwnedResponse> for IncomingResponse<'a> {
fn from(r: &'a OwnedResponse) -> Self {
match r {
OwnedResponse::KeysClaim(r) => IncomingResponse::KeysClaim(r),
OwnedResponse::KeysQuery(r) => IncomingResponse::KeysQuery(r),
OwnedResponse::KeysUpload(r) => IncomingResponse::KeysUpload(r),