Skip to content

Commit 32b68c1

Browse files
committed
shorten as_str()
1 parent 0b4dc3e commit 32b68c1

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/backend/nc_notify.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ impl NCNotify {
2626
number_of_unread: usize,
2727
) -> Result<(), Box<dyn std::error::Error>> {
2828
let mut notification = Notification::new()
29-
.summary(format!("Unread: {room_name}").as_str())
30-
.body(format!("You have {number_of_unread} new Messages in {room_name}").as_str())
29+
.summary(&format!("Unread: {room_name}"))
30+
.body(&format!(
31+
"You have {number_of_unread} new Messages in {room_name}"
32+
))
3133
.icon("dialog-information")
32-
.appname(self.app_name.as_str())
34+
.appname(&self.app_name)
3335
.to_owned();
3436
if self.persistent {
3537
log::debug!("Persistent Message!");
@@ -47,10 +49,10 @@ impl NCNotify {
4749

4850
pub fn new_room(&self, room_name: &String) -> Result<(), Box<dyn std::error::Error>> {
4951
let mut notification = Notification::new()
50-
.summary(format!("New Room: {room_name}").as_str())
51-
.body(format!("You have been added to a new Room {room_name}").as_str())
52+
.summary(&format!("New Room: {room_name}"))
53+
.body(&format!("You have been added to a new Room {room_name}"))
5254
.icon("dialog-information")
53-
.appname(self.app_name.as_str())
55+
.appname(&self.app_name)
5456
.to_owned();
5557
if self.persistent {
5658
notification

0 commit comments

Comments
 (0)