events: Use rename_all rule for CancelCode

The required rename rule exists so remove the TODO and use it.
This commit is contained in:
Kévin Commaille 2024-12-07 17:04:14 +01:00 committed by strawberry
parent 2a97aa9c4e
commit 739334ac94

View File

@ -66,61 +66,50 @@ impl KeyVerificationCancelEventContent {
/// ///
/// Custom error codes should use the Java package naming convention. /// Custom error codes should use the Java package naming convention.
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))] #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
// FIXME: Add `m.foo_bar` as a naming scheme in StringEnum and remove rename attributes.
#[derive(Clone, PartialEq, Eq, StringEnum)] #[derive(Clone, PartialEq, Eq, StringEnum)]
#[ruma_enum(rename_all = "m.snake_case")]
#[non_exhaustive] #[non_exhaustive]
pub enum CancelCode { pub enum CancelCode {
/// The user cancelled the verification. /// The user cancelled the verification.
#[ruma_enum(rename = "m.user")]
User, User,
/// The verification process timed out. /// The verification process timed out.
/// ///
/// Verification processes can define their own timeout parameters. /// Verification processes can define their own timeout parameters.
#[ruma_enum(rename = "m.timeout")]
Timeout, Timeout,
/// The device does not know about the given transaction ID. /// The device does not know about the given transaction ID.
#[ruma_enum(rename = "m.unknown_transaction")]
UnknownTransaction, UnknownTransaction,
/// The device does not know how to handle the requested method. /// The device does not know how to handle the requested method.
/// ///
/// Should be sent for `m.key.verification.start` messages and messages defined by individual /// Should be sent for `m.key.verification.start` messages and messages defined by individual
/// verification processes. /// verification processes.
#[ruma_enum(rename = "m.unknown_method")]
UnknownMethod, UnknownMethod,
/// The device received an unexpected message. /// The device received an unexpected message.
/// ///
/// Typically raised when one of the parties is handling the verification out of order. /// Typically raised when one of the parties is handling the verification out of order.
#[ruma_enum(rename = "m.unexpected_message")]
UnexpectedMessage, UnexpectedMessage,
/// The key was not verified. /// The key was not verified.
#[ruma_enum(rename = "m.key_mismatch")]
KeyMismatch, KeyMismatch,
/// The expected user did not match the user verified. /// The expected user did not match the user verified.
#[ruma_enum(rename = "m.user_mismatch")]
UserMismatch, UserMismatch,
/// The message received was invalid. /// The message received was invalid.
#[ruma_enum(rename = "m.invalid_message")]
InvalidMessage, InvalidMessage,
/// An `m.key.verification.request` was accepted by a different device. /// An `m.key.verification.request` was accepted by a different device.
/// ///
/// The device receiving this error can ignore the verification request. /// The device receiving this error can ignore the verification request.
#[ruma_enum(rename = "m.accepted")]
Accepted, Accepted,
/// The device receiving this error can ignore the verification request. /// The device receiving this error can ignore the verification request.
#[ruma_enum(rename = "m.mismatched_commitment")]
MismatchedCommitment, MismatchedCommitment,
/// The SAS did not match. /// The SAS did not match.
#[ruma_enum(rename = "m.mismatched_sas")]
MismatchedSas, MismatchedSas,
#[doc(hidden)] #[doc(hidden)]