style: auto-format entire codebase with cargo fmt (stable rustfmt.toml)
Some checks failed
ci/woodpecker/pr/check Pipeline failed
CI / Check (pull_request) Has been cancelled
CI / Format (pull_request) Has been cancelled
CI / Clippy (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build (windows-latest) (pull_request) Has been cancelled

This commit is contained in:
Mikhail Kilin
2026-02-22 17:09:51 +03:00
parent 2442a90e23
commit 264f183510
90 changed files with 1632 additions and 1450 deletions

View File

@@ -179,11 +179,7 @@ impl MessageInfo {
edit_date,
media_album_id: 0,
},
content: MessageContent {
text: content,
entities,
media: None,
},
content: MessageContent { text: content, entities, media: None },
state: MessageState {
is_outgoing,
is_read,
@@ -191,11 +187,7 @@ impl MessageInfo {
can_be_deleted_only_for_self,
can_be_deleted_for_all_users,
},
interactions: MessageInteractions {
reply_to,
forward_from,
reactions,
},
interactions: MessageInteractions { reply_to, forward_from, reactions },
}
}
@@ -251,10 +243,7 @@ impl MessageInfo {
/// Checks if the message contains a mention (@username or user mention)
pub fn has_mention(&self) -> bool {
self.content.entities.iter().any(|entity| {
matches!(
entity.r#type,
TextEntityType::Mention | TextEntityType::MentionName(_)
)
matches!(entity.r#type, TextEntityType::Mention | TextEntityType::MentionName(_))
})
}
@@ -314,13 +303,13 @@ impl MessageInfo {
}
/// Builder для удобного создания MessageInfo с fluent API
///
///
/// # Примеры
///
///
/// ```
/// use tele_tui::tdlib::MessageBuilder;
/// use tele_tui::types::MessageId;
///
///
/// let message = MessageBuilder::new(MessageId::new(123))
/// .sender_name("Alice")
/// .text("Hello, world!")
@@ -500,7 +489,6 @@ impl MessageBuilder {
}
}
#[cfg(test)]
mod tests {
use super::*;
@@ -568,9 +556,7 @@ mod tests {
#[test]
fn test_message_builder_with_reactions() {
let reaction = ReactionInfo {
emoji: "👍".to_string(),
count: 5,
is_chosen: true,
emoji: "👍".to_string(), count: 5, is_chosen: true
};
let message = MessageBuilder::new(MessageId::new(300))
@@ -628,9 +614,9 @@ mod tests {
.entities(vec![TextEntity {
offset: 6,
length: 4,
r#type: TextEntityType::MentionName(
tdlib_rs::types::TextEntityTypeMentionName { user_id: 123 },
),
r#type: TextEntityType::MentionName(tdlib_rs::types::TextEntityTypeMentionName {
user_id: 123,
}),
}])
.build();
assert!(message_with_mention_name.has_mention());