Skip to content

Commit e8cf373

Browse files
committed
replace push_str(format! with write!
clippy::format_push_string
1 parent 71c18be commit e8cf373

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/notification_listing.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::fmt::Write;
12
use std::sync::Arc;
23

34
use anyhow::Context as _;
@@ -39,15 +40,16 @@ pub async fn notifications(
3940
out.push_str("</head>");
4041
out.push_str("<body>");
4142

42-
out.push_str(&format!("<h3>Pending notifications for {}</h3>", user));
43+
_ = write!(out, "<h3>Pending notifications for {user}</h3>");
4344

4445
if notifications.is_empty() {
4546
out.push_str("<p><em>You have no pending notifications! :)</em></p>");
4647
} else {
4748
out.push_str("<ol>");
4849
for notification in notifications {
4950
out.push_str("<li>");
50-
out.push_str(&format!(
51+
_ = write!(
52+
out,
5153
"<a href='{}'>{}</a>",
5254
notification.origin_url,
5355
notification
@@ -59,17 +61,18 @@ pub async fn notifications(
5961
.replace('>', "&gt;")
6062
.replace('"', "&quot;")
6163
.replace('\'', "&#39;"),
62-
));
64+
);
6365
if let Some(metadata) = &notification.metadata {
64-
out.push_str(&format!(
66+
_ = write!(
67+
out,
6568
"<ul><li>{}</li></ul>",
6669
metadata
6770
.replace('&', "&amp;")
6871
.replace('<', "&lt;")
6972
.replace('>', "&gt;")
7073
.replace('"', "&quot;")
7174
.replace('\'', "&#39;"),
72-
));
75+
);
7376
}
7477
out.push_str("</li>");
7578
}

0 commit comments

Comments
 (0)