Skip to content

Commit e1039d3

Browse files
committed
style: format code with cargo +nightly fmt
1 parent 491c1c0 commit e1039d3

17 files changed

Lines changed: 583 additions & 282 deletions

File tree

src/app/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ impl App {
108108
// Convert icon_emoji_id to string representation if present
109109
let icon_emoji = topic.icon_emoji_id.map(|id| id.to_string());
110110

111-
self.get_store().await?.upsert_topic(
111+
self.get_store()
112+
.await?
113+
.upsert_topic(
112114
chat_id,
113115
topic.id,
114116
&topic.title,

src/app/send.rs

Lines changed: 54 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,27 @@ use tl::enums::SendMessageAction;
1616

1717
/// Parse message text according to parse_mode, returning (text, entities).
1818
/// parse_mode: "markdown", "html", or anything else for plain text.
19-
fn apply_parse_mode(text: &str, parse_mode: &str) -> (String, Option<Vec<tl::enums::MessageEntity>>) {
19+
fn apply_parse_mode(
20+
text: &str,
21+
parse_mode: &str,
22+
) -> (String, Option<Vec<tl::enums::MessageEntity>>) {
2023
match parse_mode {
2124
"markdown" => {
2225
let (parsed_text, entities) = parse_markdown_message(text);
23-
let ents = if entities.is_empty() { None } else { Some(entities) };
26+
let ents = if entities.is_empty() {
27+
None
28+
} else {
29+
Some(entities)
30+
};
2431
(parsed_text, ents)
2532
}
2633
"html" => {
2734
let (parsed_text, entities) = parse_html_message(text);
28-
let ents = if entities.is_empty() { None } else { Some(entities) };
35+
let ents = if entities.is_empty() {
36+
None
37+
} else {
38+
Some(entities)
39+
};
2940
(parsed_text, ents)
3041
}
3142
_ => (text.to_string(), None),
@@ -71,7 +82,8 @@ impl App {
7182
.context_send(chat_id)?;
7283

7384
let now = Utc::now();
74-
self.get_store().await?
85+
self.get_store()
86+
.await?
7587
.upsert_message(UpsertMessageParams {
7688
id: msg.id() as i64,
7789
chat_id,
@@ -88,7 +100,8 @@ impl App {
88100
.await?;
89101

90102
// Update chat's last_message_ts
91-
self.get_store().await?
103+
self.get_store()
104+
.await?
92105
.upsert_chat(chat_id, "user", "", None, Some(now), false, None, false)
93106
.await?;
94107

@@ -206,7 +219,8 @@ impl App {
206219
let msg_id = Self::extract_message_id_from_updates(&updates)?;
207220

208221
let now = Utc::now();
209-
self.get_store().await?
222+
self.get_store()
223+
.await?
210224
.upsert_message(UpsertMessageParams {
211225
id: msg_id,
212226
chat_id,
@@ -223,7 +237,8 @@ impl App {
223237
.await?;
224238

225239
// Update chat's last_message_ts
226-
self.get_store().await?
240+
self.get_store()
241+
.await?
227242
.upsert_chat(chat_id, "user", "", None, Some(now), false, None, false)
228243
.await?;
229244

@@ -291,7 +306,8 @@ impl App {
291306
let msg_id = Self::extract_message_id_from_updates(&updates)?;
292307

293308
let now = Utc::now();
294-
self.get_store().await?
309+
self.get_store()
310+
.await?
295311
.upsert_message(UpsertMessageParams {
296312
id: msg_id,
297313
chat_id,
@@ -308,7 +324,8 @@ impl App {
308324
.await?;
309325

310326
// Update chat's last_message_ts
311-
self.get_store().await?
327+
self.get_store()
328+
.await?
312329
.upsert_chat(chat_id, "user", "", None, Some(now), false, None, false)
313330
.await?;
314331

@@ -419,7 +436,8 @@ impl App {
419436
))?;
420437

421438
// Update local store
422-
self.get_store().await?
439+
self.get_store()
440+
.await?
423441
.update_message_text(chat_id, msg_id, new_text)
424442
.await?;
425443

@@ -554,7 +572,8 @@ impl App {
554572
.context(format!("Failed to send sticker to chat {}", chat_id))?;
555573

556574
let now = Utc::now();
557-
self.get_store().await?
575+
self.get_store()
576+
.await?
558577
.upsert_message(UpsertMessageParams {
559578
id: msg.id() as i64,
560579
chat_id,
@@ -571,7 +590,8 @@ impl App {
571590
.await?;
572591

573592
// Update chat's last_message_ts
574-
self.get_store().await?
593+
self.get_store()
594+
.await?
575595
.upsert_chat(chat_id, "user", "", None, Some(now), false, None, false)
576596
.await?;
577597

@@ -599,7 +619,8 @@ impl App {
599619
.context(format!("Failed to send photo to chat {}", chat_id))?;
600620

601621
let now = Utc::now();
602-
self.get_store().await?
622+
self.get_store()
623+
.await?
603624
.upsert_message(UpsertMessageParams {
604625
id: msg.id() as i64,
605626
chat_id,
@@ -616,7 +637,8 @@ impl App {
616637
.await?;
617638

618639
// Update chat's last_message_ts
619-
self.get_store().await?
640+
self.get_store()
641+
.await?
620642
.upsert_chat(chat_id, "user", "", None, Some(now), false, None, false)
621643
.await?;
622644

@@ -656,7 +678,8 @@ impl App {
656678
.context(format!("Failed to send video to chat {}", chat_id))?;
657679

658680
let now = Utc::now();
659-
self.get_store().await?
681+
self.get_store()
682+
.await?
660683
.upsert_message(UpsertMessageParams {
661684
id: msg.id() as i64,
662685
chat_id,
@@ -673,7 +696,8 @@ impl App {
673696
.await?;
674697

675698
// Update chat's last_message_ts
676-
self.get_store().await?
699+
self.get_store()
700+
.await?
677701
.upsert_chat(chat_id, "user", "", None, Some(now), false, None, false)
678702
.await?;
679703

@@ -705,7 +729,8 @@ impl App {
705729
.context(format!("Failed to send file to chat {}", chat_id))?;
706730

707731
let now = Utc::now();
708-
self.get_store().await?
732+
self.get_store()
733+
.await?
709734
.upsert_message(UpsertMessageParams {
710735
id: msg.id() as i64,
711736
chat_id,
@@ -722,7 +747,8 @@ impl App {
722747
.await?;
723748

724749
// Update chat's last_message_ts
725-
self.get_store().await?
750+
self.get_store()
751+
.await?
726752
.upsert_chat(chat_id, "user", "", None, Some(now), false, None, false)
727753
.await?;
728754

@@ -760,7 +786,8 @@ impl App {
760786
.context(format!("Failed to send voice message to chat {}", chat_id))?;
761787

762788
let now = Utc::now();
763-
self.get_store().await?
789+
self.get_store()
790+
.await?
764791
.upsert_message(UpsertMessageParams {
765792
id: msg.id() as i64,
766793
chat_id,
@@ -777,7 +804,8 @@ impl App {
777804
.await?;
778805

779806
// Update chat's last_message_ts
780-
self.get_store().await?
807+
self.get_store()
808+
.await?
781809
.upsert_chat(chat_id, "user", "", None, Some(now), false, None, false)
782810
.await?;
783811

@@ -910,7 +938,8 @@ impl App {
910938
let reply_to_id = msg.reply_to_message_id().map(|id| id as i64);
911939
let media_type = msg.media().map(|_| "media".to_string());
912940

913-
self.get_store().await?
941+
self.get_store()
942+
.await?
914943
.upsert_message(UpsertMessageParams {
915944
id: msg.id() as i64,
916945
chat_id,
@@ -1031,7 +1060,8 @@ impl App {
10311060
let msg_id = Self::extract_message_id_from_updates(&updates)?;
10321061

10331062
let now = Utc::now();
1034-
self.get_store().await?
1063+
self.get_store()
1064+
.await?
10351065
.upsert_message(UpsertMessageParams {
10361066
id: msg_id,
10371067
chat_id,
@@ -1048,7 +1078,8 @@ impl App {
10481078
.await?;
10491079

10501080
// Update chat's last_message_ts
1051-
self.get_store().await?
1081+
self.get_store()
1082+
.await?
10521083
.upsert_chat(chat_id, "user", "", None, Some(now), false, None, false)
10531084
.await?;
10541085

0 commit comments

Comments
 (0)