chore(ffi): Justify the allow(clippy::large_enum_variant).

This commit is contained in:
Ivan Enderlin
2025-05-16 13:57:25 +02:00
parent 7ef962f931
commit eeaa091024
4 changed files with 26 additions and 0 deletions

View File

@@ -60,6 +60,14 @@ impl From<AnyTimelineEvent> for TimelineEvent {
}
#[derive(uniffi::Enum)]
// A note about this `allow(clippy::large_enum_variant)`.
// In order to reduce the size of `TimelineEventType`, we would need to
// put some parts in a `Box`, or an `Arc`. Sadly, it doesn't play well with
// UniFFI. We would need to change the `uniffi::Record` of the subtypes into
// `uniffi::Object`, which is a radical change. It would simplify the memory
// usage, but it would slow down the performance around the FFI border. Thus,
// let's consider this is a false-positive lint in this particular case.
#[allow(clippy::large_enum_variant)]
pub enum TimelineEventType {
MessageLike { content: MessageLikeEventContent },
State { content: StateEventContent },
@@ -134,6 +142,14 @@ impl TryFrom<AnySyncStateEvent> for StateEventContent {
}
#[derive(uniffi::Enum)]
// A note about this `allow(clippy::large_enum_variant)`.
// In order to reduce the size of `MessageLineEventContent`, we would need to
// put some parts in a `Box`, or an `Arc`. Sadly, it doesn't play well with
// UniFFI. We would need to change the `uniffi::Record` of the subtypes into
// `uniffi::Object`, which is a radical change. It would simplify the memory
// usage, but it would slow down the performance around the FFI border. Thus,
// let's consider this is a false-positive lint in this particular case.
#[allow(clippy::large_enum_variant)]
pub enum MessageLikeEventContent {
CallAnswer,
CallInvite,

View File

@@ -96,6 +96,14 @@ impl From<matrix_sdk_ui::timeline::TimelineItemContent> for TimelineItemContent
}
#[derive(Clone, uniffi::Enum)]
// A note about this `allow(clippy::large_enum_variant)`.
// In order to reduce the size of `TimelineItemContent`, we would need to
// put some parts in a `Box`, or an `Arc`. Sadly, it doesn't play well with
// UniFFI. We would need to change the `uniffi::Record` of the subtypes into
// `uniffi::Object`, which is a radical change. It would simplify the memory
// usage, but it would slow down the performance around the FFI border. Thus,
// let's consider this is a false-positive lint in this particular case.
#[allow(clippy::large_enum_variant)]
pub enum TimelineItemContent {
MsgLike {
content: MsgLikeContent,

View File

@@ -252,6 +252,7 @@ impl ThreadSummary {
}
#[derive(Clone, uniffi::Enum)]
#[allow(clippy::large_enum_variant)]
pub enum ThreadSummaryLatestEventDetails {
Unavailable,
Pending,

View File

@@ -60,6 +60,7 @@ impl From<matrix_sdk_ui::timeline::InReplyToDetails> for InReplyToDetails {
}
#[derive(Clone, uniffi::Enum)]
#[allow(clippy::large_enum_variant)]
pub enum RepliedToEventDetails {
Unavailable,
Pending,