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, } }