From 6ffb0181e46f2d054ee6fb2b5201c31e249c43de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Fri, 15 Dec 2023 11:01:03 +0100 Subject: [PATCH] Make sure qrcode feature is additive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kévin Commaille --- crates/matrix-sdk/CHANGELOG.md | 1 + crates/matrix-sdk/src/encryption/verification/mod.rs | 1 + examples/emoji_verification/src/main.rs | 7 ++++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/matrix-sdk/CHANGELOG.md b/crates/matrix-sdk/CHANGELOG.md index fae1ea269..73daf4635 100644 --- a/crates/matrix-sdk/CHANGELOG.md +++ b/crates/matrix-sdk/CHANGELOG.md @@ -34,6 +34,7 @@ Breaking changes: are still allowed, but so are other types like `Box` - All "named futures" (structs implementing `IntoFuture`) are now exported from modules named `futures` instead of directly in the respective parent module +- `Verification` is non-exhaustive, to make the `qrcode` cargo feature additive Bug fixes: diff --git a/crates/matrix-sdk/src/encryption/verification/mod.rs b/crates/matrix-sdk/src/encryption/verification/mod.rs index 9aa7975b7..f571d3ce7 100644 --- a/crates/matrix-sdk/src/encryption/verification/mod.rs +++ b/crates/matrix-sdk/src/encryption/verification/mod.rs @@ -53,6 +53,7 @@ pub use sas::SasVerification; /// An enum over the different verification types the SDK supports. #[derive(Debug, Clone)] +#[non_exhaustive] pub enum Verification { /// The `m.sas.v1` verification variant. SasV1(SasVerification), diff --git a/examples/emoji_verification/src/main.rs b/examples/emoji_verification/src/main.rs index 5195fea79..cf6a5da51 100644 --- a/examples/emoji_verification/src/main.rs +++ b/examples/emoji_verification/src/main.rs @@ -107,12 +107,13 @@ async fn request_verification_handler(client: Client, request: VerificationReque VerificationRequestState::Created { .. } | VerificationRequestState::Requested { .. } | VerificationRequestState::Ready { .. } => (), - VerificationRequestState::Transitioned { verification } => match verification { - Verification::SasV1(s) => { + VerificationRequestState::Transitioned { verification } => { + // We only support SAS verification. + if let Verification::SasV1(s) = verification { tokio::spawn(sas_verification_handler(client, s)); break; } - }, + } VerificationRequestState::Done | VerificationRequestState::Cancelled(_) => break, } }