skoupidi 1 год назад
Родитель
Сommit
b76da20baf

+ 21 - 21
bin/darkirc/src/irc/client.rs

@@ -172,7 +172,7 @@ impl Client {
                     }
                     // If something failed during reading, we disconnect.
                     if let Err(e) = r {
-                        error!("[IRC CLIENT] Read failed for {}: {}", self.addr, e);
+                        error!("[IRC CLIENT] Read failed for {}: {e}", self.addr);
                         self.incoming.unsubscribe().await;
                         return Err(Error::ChannelStopped)
                     }
@@ -197,11 +197,11 @@ impl Client {
 
                                 // If it fails for some reason, for now, we just note it and pass.
                                 if let Err(e) = self.server.darkirc.event_graph.dag_insert(&[event.clone()]).await {
-                                    error!("[IRC CLIENT] Failed inserting new event to DAG: {}", e);
+                                    error!("[IRC CLIENT] Failed inserting new event to DAG: {e}");
                                 } else {
                                     // We sent this, so it should be considered seen.
                                     if let Err(e) = self.mark_seen(&event_id).await {
-                                        error!("[IRC CLIENT] (multiplex_connection) self.mark_seen({}) failed: {}", event_id, e);
+                                        error!("[IRC CLIENT] (multiplex_connection) self.mark_seen({event_id}) failed: {e}");
                                         return Err(e)
                                     }
 
@@ -220,7 +220,7 @@ impl Client {
                                             Ok(v) => v,
                                             Err(e) => {
                                                 // TODO: Send a message to the IRC client telling that sending went wrong
-                                                error!("[IRC CLIENT] Failed creating RLN signal proof: {}", e);
+                                                error!("[IRC CLIENT] Failed creating RLN signal proof: {e}");
                                                 // Just use an empty "proof"
                                                 (Proof::new(vec![]), vec![])
                                             }
@@ -267,7 +267,7 @@ impl Client {
                         Ok(true) => continue,
                         Ok(false) => {},
                         Err(e) => {
-                            error!("[IRC CLIENT] (multiplex_connection) self.is_seen({}) failed: {}", event_id, e);
+                            error!("[IRC CLIENT] (multiplex_connection) self.is_seen({event_id}) failed: {e}");
                             return Err(e)
                         }
                     }
@@ -284,7 +284,7 @@ impl Client {
                             Err(_) => {
                                 // TODO: FIXME: This logic should be better written.
                                 // Right now we don't enforce RLN so we can just fall-through.
-                                //error!("[IRC CLIENT] Failed deserializing event ephemeral data: {}", e);
+                                //error!("[IRC CLIENT] Failed deserializing event ephemeral data: {e}");
                                 break
                             }
                         };
@@ -320,7 +320,7 @@ impl Client {
                         Ok(Msg::V1(old_msg)) => old_msg.into_new(),
                         Ok(Msg::V2(new_msg)) => new_msg,
                         Err(e) => {
-                            error!("[IRC CLIENT] Failed deserializing incoming Privmsg event: {}", e);
+                            error!("[IRC CLIENT] Failed deserializing incoming Privmsg event: {e}");
                             continue
                         }
                     };
@@ -360,19 +360,19 @@ impl Client {
                         }
 
                         // Format the message
-                        let msg = format!("PRIVMSG {} :{}", privmsg.channel, line);
+                        let msg = format!("PRIVMSG {} :{line}", privmsg.channel);
 
                         // Send it to the client
                         let reply = ReplyType::Client((privmsg.nick.clone(), msg));
                         if let Err(e) = self.reply(&mut writer, &reply).await {
-                            error!("[IRC CLIENT] Failed writing PRIVMSG to client: {}", e);
+                            error!("[IRC CLIENT] Failed writing PRIVMSG to client: {e}");
                             continue
                         }
                     }
 
                     // Mark the message as seen for this USER
                     if let Err(e) = self.mark_seen(&event_id).await {
-                        error!("[IRC CLIENT] (multiplex_connection) self.mark_seen({}) failed: {}", event_id, e);
+                        error!("[IRC CLIENT] (multiplex_connection) self.mark_seen({event_id}) failed: {e}");
                         return Err(e)
                     }
                 }
@@ -386,16 +386,16 @@ impl Client {
         W: AsyncWrite + Unpin,
     {
         let r = match reply {
-            ReplyType::Server((rpl, msg)) => format!(":{} {:03} {}", SERVER_NAME, rpl, msg),
-            ReplyType::Client((nick, msg)) => format!(":{}!~anon@darkirc {}", nick, msg),
-            ReplyType::Pong(origin) => format!(":{} PONG :{}", SERVER_NAME, origin),
-            ReplyType::Cap(msg) => format!(":{} {}", SERVER_NAME, msg),
+            ReplyType::Server((rpl, msg)) => format!(":{SERVER_NAME} {rpl:03} {msg}"),
+            ReplyType::Client((nick, msg)) => format!(":{nick}!~anon@darkirc {msg}"),
+            ReplyType::Pong(origin) => format!(":{SERVER_NAME} PONG :{origin}"),
+            ReplyType::Cap(msg) => format!(":{SERVER_NAME} {msg}"),
             ReplyType::Notice((src, dst, msg)) => {
-                format!(":{}!~anon@darkirc NOTICE {} :{}", src, dst, msg)
+                format!(":{src}!~anon@darkirc NOTICE {dst} :{msg}")
             }
         };
 
-        debug!("[{}] <-- {}", self.addr, r);
+        debug!("[{}] <-- {r}", self.addr);
 
         writer.write(r.as_bytes()).await?;
         writer.write(b"\r\n").await?;
@@ -454,7 +454,7 @@ impl Client {
         let args = line.replacen(cmd, "", 1);
         let cmd = cmd.to_uppercase();
 
-        debug!("[{}] --> {}{}", self.addr, cmd, args);
+        debug!("[{}] --> {cmd}{args}", self.addr);
 
         // Handle the command. These implementations are in `command.rs`.
         let replies: Vec<ReplyType> = match cmd.as_str() {
@@ -477,7 +477,7 @@ impl Client {
             "VERSION" => self.handle_cmd_version(&args).await?,
             "QUIT" => return Err(Error::ChannelStopped),
             _ => {
-                warn!("[IRC CLIENT] Unimplemented \"{}\" command", cmd);
+                warn!("[IRC CLIENT] Unimplemented \"{cmd}\" command");
                 vec![]
             }
         };
@@ -554,11 +554,11 @@ impl Client {
             .seen
             .get_or_init(|| async {
                 let u = self.username.read().await.to_string();
-                self.server.darkirc.sled.open_tree(format!("darkirc_user_{}", u)).unwrap()
+                self.server.darkirc.sled.open_tree(format!("darkirc_user_{u}")).unwrap()
             })
             .await;
 
-        debug!("Marking event {} as seen", event_id);
+        debug!("Marking event {event_id} as seen");
         let mut batch = sled::Batch::default();
         batch.insert(event_id.as_bytes(), &[]);
         Ok(db.apply_batch(batch)?)
@@ -570,7 +570,7 @@ impl Client {
             .seen
             .get_or_init(|| async {
                 let u = self.username.read().await.to_string();
-                self.server.darkirc.sled.open_tree(format!("darkirc_user_{}", u)).unwrap()
+                self.server.darkirc.sled.open_tree(format!("darkirc_user_{u}")).unwrap()
             })
             .await;
 

+ 82 - 137
bin/darkirc/src/irc/command.rs

@@ -69,22 +69,16 @@ impl Client {
     pub async fn handle_cmd_admin(&self, _args: &str) -> Result<Vec<ReplyType>> {
         if !self.registered.load(SeqCst) {
             self.penalty.fetch_add(1, SeqCst);
-            return Ok(vec![ReplyType::Server((
-                ERR_NOTREGISTERED,
-                format!("* :{}", NOT_REGISTERED),
-            ))])
+            return Ok(vec![ReplyType::Server((ERR_NOTREGISTERED, format!("* :{NOT_REGISTERED}")))])
         }
 
         let nick = self.nickname.read().await.to_string();
 
         let replies = vec![
-            ReplyType::Server((
-                RPL_ADMINME,
-                format!("{} {} :Administrative info", nick, SERVER_NAME),
-            )),
-            ReplyType::Server((RPL_ADMINLOC1, format!("{} :", nick))),
-            ReplyType::Server((RPL_ADMINLOC2, format!("{} :", nick))),
-            ReplyType::Server((RPL_ADMINEMAIL, format!("{} :anon@darkirc", nick))),
+            ReplyType::Server((RPL_ADMINME, format!("{nick} {SERVER_NAME} :Administrative info"))),
+            ReplyType::Server((RPL_ADMINLOC1, format!("{nick} :"))),
+            ReplyType::Server((RPL_ADMINLOC2, format!("{nick} :"))),
+            ReplyType::Server((RPL_ADMINEMAIL, format!("{nick} :anon@darkirc"))),
         ];
 
         Ok(replies)
@@ -98,7 +92,7 @@ impl Client {
             self.penalty.fetch_add(1, SeqCst);
             return Ok(vec![ReplyType::Server((
                 ERR_NEEDMOREPARAMS,
-                format!("{} CAP :{}", self.nickname.read().await, INVALID_SYNTAX),
+                format!("{} CAP :{INVALID_SYNTAX}", self.nickname.read().await),
             ))])
         };
 
@@ -111,7 +105,7 @@ impl Client {
                 let Some(_version) = tokens.next() else {
                     return Ok(vec![ReplyType::Server((
                         ERR_NEEDMOREPARAMS,
-                        format!("{} CAP :{}", self.nickname.read().await, INVALID_SYNTAX),
+                        format!("{} CAP :{INVALID_SYNTAX}", self.nickname.read().await),
                     ))])
                 };
                 */
@@ -124,14 +118,14 @@ impl Client {
                 let Some(substr_idx) = args.find(':') else {
                     return Ok(vec![ReplyType::Server((
                         ERR_NEEDMOREPARAMS,
-                        format!("{} CAP :{}", nick, INVALID_SYNTAX),
+                        format!("{nick} CAP :{INVALID_SYNTAX}"),
                     ))])
                 };
 
                 if substr_idx >= args.len() {
                     return Ok(vec![ReplyType::Server((
                         ERR_NEEDMOREPARAMS,
-                        format!("{} CAP :{}", nick, INVALID_SYNTAX),
+                        format!("{nick} CAP :{INVALID_SYNTAX}"),
                     ))])
                 }
 
@@ -153,19 +147,11 @@ impl Client {
                 let mut replies = vec![];
 
                 if !ack_list.is_empty() {
-                    replies.push(ReplyType::Cap(format!(
-                        "CAP {} ACK :{}",
-                        nick,
-                        ack_list.join(" ")
-                    )));
+                    replies.push(ReplyType::Cap(format!("CAP {nick} ACK :{}", ack_list.join(" "))));
                 }
 
                 if !nak_list.is_empty() {
-                    replies.push(ReplyType::Cap(format!(
-                        "CAP {} NAK :{}",
-                        nick,
-                        nak_list.join(" ")
-                    )));
+                    replies.push(ReplyType::Cap(format!("CAP {nick} NAK :{}", nak_list.join(" "))));
                 }
 
                 return Ok(replies)
@@ -183,8 +169,7 @@ impl Client {
                     .collect();
 
                 return Ok(vec![ReplyType::Cap(format!(
-                    "CAP {} LIST :{}",
-                    nick,
+                    "CAP {nick} LIST :{}",
                     enabled_caps.join(" ")
                 ))])
             }
@@ -204,10 +189,7 @@ impl Client {
         }
 
         self.penalty.fetch_add(1, SeqCst);
-        Ok(vec![ReplyType::Server((
-            ERR_NEEDMOREPARAMS,
-            format!("{} CAP :{}", nick, INVALID_SYNTAX),
-        ))])
+        Ok(vec![ReplyType::Server((ERR_NEEDMOREPARAMS, format!("{nick} CAP :{INVALID_SYNTAX}")))])
     }
 
     /// `INFO [<target>]`
@@ -219,19 +201,13 @@ impl Client {
     pub async fn handle_cmd_info(&self, _args: &str) -> Result<Vec<ReplyType>> {
         if !self.registered.load(SeqCst) {
             self.penalty.fetch_add(1, SeqCst);
-            return Ok(vec![ReplyType::Server((
-                ERR_NOTREGISTERED,
-                format!("* :{}", NOT_REGISTERED),
-            ))])
+            return Ok(vec![ReplyType::Server((ERR_NOTREGISTERED, format!("* :{NOT_REGISTERED}")))])
         }
 
         let nick = self.nickname.read().await.clone();
         let replies = vec![
-            ReplyType::Server((
-                RPL_INFO,
-                format!("{} :DarkIRC {}", nick, env!("CARGO_PKG_VERSION")),
-            )),
-            ReplyType::Server((RPL_ENDOFINFO, format!("{} :End of INFO list", nick))),
+            ReplyType::Server((RPL_INFO, format!("{nick} :DarkIRC {}", env!("CARGO_PKG_VERSION")))),
+            ReplyType::Server((RPL_ENDOFINFO, format!("{nick} :End of INFO list"))),
         ];
 
         Ok(replies)
@@ -245,10 +221,7 @@ impl Client {
     pub async fn handle_cmd_join(&self, args: &str, hist: bool) -> Result<Vec<ReplyType>> {
         if !self.registered.load(SeqCst) {
             self.penalty.fetch_add(1, SeqCst);
-            return Ok(vec![ReplyType::Server((
-                ERR_NOTREGISTERED,
-                format!("* :{}", NOT_REGISTERED),
-            ))])
+            return Ok(vec![ReplyType::Server((ERR_NOTREGISTERED, format!("* :{NOT_REGISTERED}")))])
         }
 
         // Client's (already) active channels
@@ -265,7 +238,7 @@ impl Client {
                 self.penalty.fetch_add(1, SeqCst);
                 return Ok(vec![ReplyType::Server((
                     ERR_NEEDMOREPARAMS,
-                    format!("{} JOIN :{}", nick, INVALID_SYNTAX),
+                    format!("{nick} JOIN :{INVALID_SYNTAX}"),
                 ))])
             }
 
@@ -284,7 +257,7 @@ impl Client {
                     self.penalty.fetch_add(1, SeqCst);
                     return Ok(vec![ReplyType::Server((
                         ERR_NEEDMOREPARAMS,
-                        format!("{} JOIN :{}", nick, INVALID_SYNTAX),
+                        format!("{nick} JOIN :{INVALID_SYNTAX}"),
                     ))])
                 }
                 if !active_channels.contains(channel) {
@@ -313,13 +286,13 @@ impl Client {
             }
 
             // Create the replies
-            replies.push(ReplyType::Client((nick.clone(), format!("JOIN :{}", channel))));
+            replies.push(ReplyType::Client((nick.clone(), format!("JOIN :{channel}"))));
 
             if let Some(chan) = server_channels.get(channel) {
                 if !chan.topic.is_empty() {
                     replies.push(ReplyType::Client((
                         nick.clone(),
-                        format!("TOPIC {} :{}", channel, chan.topic),
+                        format!("TOPIC {channel} :{}", chan.topic),
                     )));
                 }
             }
@@ -345,25 +318,22 @@ impl Client {
     pub async fn handle_cmd_list(&self, _args: &str) -> Result<Vec<ReplyType>> {
         if !self.registered.load(SeqCst) {
             self.penalty.fetch_add(1, SeqCst);
-            return Ok(vec![ReplyType::Server((
-                ERR_NOTREGISTERED,
-                format!("* :{}", NOT_REGISTERED),
-            ))])
+            return Ok(vec![ReplyType::Server((ERR_NOTREGISTERED, format!("* :{NOT_REGISTERED}")))])
         }
 
         let nick = self.nickname.read().await.to_string();
 
         let mut list = vec![];
         for (name, channel) in self.server.channels.read().await.iter() {
-            list.push(format!("{} {} {} :{}", nick, name, channel.nicks.len(), channel.topic));
+            list.push(format!("{nick} {name} {} :{}", channel.nicks.len(), channel.topic));
         }
 
         let mut replies = vec![];
-        replies.push(ReplyType::Server((RPL_LISTSTART, format!("{} Channel :Users  Name", nick))));
+        replies.push(ReplyType::Server((RPL_LISTSTART, format!("{nick} Channel :Users  Name"))));
         for chan in list {
             replies.push(ReplyType::Server((RPL_LIST, chan)));
         }
-        replies.push(ReplyType::Server((RPL_LISTEND, format!("{} :End of /LIST", nick))));
+        replies.push(ReplyType::Server((RPL_LISTEND, format!("{nick} :End of /LIST"))));
 
         Ok(replies)
     }
@@ -376,10 +346,7 @@ impl Client {
     pub async fn handle_cmd_mode(&self, args: &str) -> Result<Vec<ReplyType>> {
         if !self.registered.load(SeqCst) {
             self.penalty.fetch_add(1, SeqCst);
-            return Ok(vec![ReplyType::Server((
-                ERR_NOTREGISTERED,
-                format!("* :{}", NOT_REGISTERED),
-            ))])
+            return Ok(vec![ReplyType::Server((ERR_NOTREGISTERED, format!("* :{NOT_REGISTERED}")))])
         }
 
         let nick = self.nickname.read().await.to_string();
@@ -390,29 +357,29 @@ impl Client {
             self.penalty.fetch_add(1, SeqCst);
             return Ok(vec![ReplyType::Server((
                 ERR_NEEDMOREPARAMS,
-                format!("{} MODE :{}", nick, INVALID_SYNTAX),
+                format!("{nick} MODE :{INVALID_SYNTAX}"),
             ))])
         };
 
         if target == nick {
-            return Ok(vec![ReplyType::Server((RPL_UMODEIS, format!("{} +", nick)))])
+            return Ok(vec![ReplyType::Server((RPL_UMODEIS, format!("{nick} +")))])
         }
 
         if !target.starts_with('#') {
             return Ok(vec![ReplyType::Server((
                 ERR_USERSDONTMATCH,
-                format!("{} :Can't set/get mode for other users", nick),
+                format!("{nick} :Can't set/get mode for other users"),
             ))])
         }
 
         if !self.server.channels.read().await.contains_key(target) {
             return Ok(vec![ReplyType::Server((
                 ERR_NOSUCHNICK,
-                format!("{} {} :No such nick or channel name", nick, target),
+                format!("{nick} {target} :No such nick or channel name"),
             ))])
         }
 
-        Ok(vec![ReplyType::Server((RPL_CHANNELMODEIS, format!("{} {} +", nick, target)))])
+        Ok(vec![ReplyType::Server((RPL_CHANNELMODEIS, format!("{nick} {target} +")))])
     }
 
     /// `MOTD [<server>]`
@@ -425,10 +392,10 @@ impl Client {
         Ok(vec![
             ReplyType::Server((
                 RPL_MOTDSTART,
-                format!("{} :- {} message of the day", nick, SERVER_NAME),
+                format!("{nick} :- {SERVER_NAME} message of the day"),
             )),
-            ReplyType::Server((RPL_MOTD, format!("{} :Let there be dark!", nick))),
-            ReplyType::Server((RPL_ENDOFMOTD, format!("{} :End of /MOTD command.", nick))),
+            ReplyType::Server((RPL_MOTD, format!("{nick} :Let there be dark!"))),
+            ReplyType::Server((RPL_ENDOFMOTD, format!("{nick} :End of /MOTD command."))),
         ])
     }
 
@@ -441,10 +408,7 @@ impl Client {
     pub async fn handle_cmd_names(&self, args: &str) -> Result<Vec<ReplyType>> {
         if !self.registered.load(SeqCst) {
             self.penalty.fetch_add(1, SeqCst);
-            return Ok(vec![ReplyType::Server((
-                ERR_NOTREGISTERED,
-                format!("* :{}", NOT_REGISTERED),
-            ))])
+            return Ok(vec![ReplyType::Server((ERR_NOTREGISTERED, format!("* :{NOT_REGISTERED}")))])
         }
 
         let nick = self.nickname.read().await.to_string();
@@ -459,13 +423,13 @@ impl Client {
 
                 replies.push(ReplyType::Server((
                     RPL_NAMREPLY,
-                    format!("{} = {} :{}", nick, req_chan, nicks.join(" ")),
+                    format!("{nick} = {req_chan} :{}", nicks.join(" ")),
                 )));
             }
 
             replies.push(ReplyType::Server((
                 RPL_ENDOFNAMES,
-                format!("{} {} :End of NAMES list", nick, req_chan),
+                format!("{nick} {req_chan} :End of NAMES list"),
             )));
 
             Ok(replies)
@@ -475,14 +439,12 @@ impl Client {
 
                 replies.push(ReplyType::Server((
                     RPL_NAMREPLY,
-                    format!("{} = {} :{}", nick, name, nicks.join(" ")),
+                    format!("{nick} = {name} :{}", nicks.join(" ")),
                 )));
             }
 
-            replies.push(ReplyType::Server((
-                RPL_ENDOFNAMES,
-                format!("{} * :End of NAMES list", nick),
-            )));
+            replies
+                .push(ReplyType::Server((RPL_ENDOFNAMES, format!("{nick} * :End of NAMES list"))));
 
             Ok(replies)
         }
@@ -502,7 +464,7 @@ impl Client {
             self.penalty.fetch_add(1, SeqCst);
             return Ok(vec![ReplyType::Server((
                 ERR_NEEDMOREPARAMS,
-                format!("{} NICK :{}", old_nick, INVALID_SYNTAX),
+                format!("{old_nick} NICK :{INVALID_SYNTAX}"),
             ))])
         };
 
@@ -512,7 +474,7 @@ impl Client {
             self.penalty.fetch_add(1, SeqCst);
             return Ok(vec![ReplyType::Server((
                 ERR_ERRONEOUSNICKNAME,
-                format!("{} {} :Erroneous nickname", old_nick, nickname),
+                format!("{old_nick} {nickname} :Erroneous nickname"),
             ))])
         }
 
@@ -521,7 +483,7 @@ impl Client {
             self.penalty.fetch_add(1, SeqCst);
             return Ok(vec![ReplyType::Server((
                 ERR_ERRONEOUSNICKNAME,
-                format!("{} {} :Nickname too long", old_nick, nickname),
+                format!("{old_nick} {nickname} :Nickname too long"),
             ))])
         }
 
@@ -543,7 +505,7 @@ impl Client {
 
         // If we were registered, we send a client reply about it.
         if self.registered.load(SeqCst) {
-            Ok(vec![ReplyType::Client((old_nick, format!("NICK :{}", nickname)))])
+            Ok(vec![ReplyType::Client((old_nick, format!("NICK :{nickname}")))])
         } else {
             // Otherwise, we don't reply.
             Ok(vec![])
@@ -556,10 +518,7 @@ impl Client {
     pub async fn handle_cmd_part(&self, args: &str) -> Result<Vec<ReplyType>> {
         if !self.registered.load(SeqCst) {
             self.penalty.fetch_add(1, SeqCst);
-            return Ok(vec![ReplyType::Server((
-                ERR_NOTREGISTERED,
-                format!("* :{}", NOT_REGISTERED),
-            ))])
+            return Ok(vec![ReplyType::Server((ERR_NOTREGISTERED, format!("* :{NOT_REGISTERED}")))])
         }
 
         let nick = self.nickname.read().await.to_string();
@@ -569,7 +528,7 @@ impl Client {
             self.penalty.fetch_add(1, SeqCst);
             return Ok(vec![ReplyType::Server((
                 ERR_NEEDMOREPARAMS,
-                format!("{} PART :{}", nick, INVALID_SYNTAX),
+                format!("{nick} PART :{INVALID_SYNTAX}"),
             ))])
         };
 
@@ -577,7 +536,7 @@ impl Client {
             self.penalty.fetch_add(1, SeqCst);
             return Ok(vec![ReplyType::Server((
                 ERR_NEEDMOREPARAMS,
-                format!("{} PART :{}", nick, INVALID_SYNTAX),
+                format!("{nick} PART :{INVALID_SYNTAX}"),
             ))])
         }
 
@@ -585,14 +544,14 @@ impl Client {
         if !active_channels.contains(channel) {
             return Ok(vec![ReplyType::Server((
                 ERR_NOSUCHCHANNEL,
-                format!("{} {} :No such channel", nick, channel),
+                format!("{nick} {channel} :No such channel"),
             ))])
         }
 
         // Remove the channel from the client's channel list
         active_channels.remove(channel);
 
-        let replies = vec![ReplyType::Client((nick, format!("PART {} :Bye", channel)))];
+        let replies = vec![ReplyType::Client((nick, format!("PART {channel} :Bye")))];
 
         Ok(replies)
     }
@@ -610,7 +569,7 @@ impl Client {
             // self.penalty.fetch_add(1, SeqCst);
             return Ok(vec![ReplyType::Server((
                 ERR_NEEDMOREPARAMS,
-                format!("{} PASS :{}", nick, INVALID_SYNTAX),
+                format!("{nick} PASS :{INVALID_SYNTAX}"),
             ))])
         };
         let mut password = &args[i + 1..];
@@ -624,7 +583,7 @@ impl Client {
             error!("[IRC CLIENT] Password is not correct!");
             return Ok(vec![ReplyType::Server((
                 ERR_PASSWDMISMATCH,
-                format!("{} PASS :{}", nick, PASSWORD_MISMATCH),
+                format!("{nick} PASS :{PASSWORD_MISMATCH}"),
             ))])
         }
 
@@ -637,10 +596,7 @@ impl Client {
     pub async fn handle_cmd_ping(&self, args: &str) -> Result<Vec<ReplyType>> {
         if !self.registered.load(SeqCst) {
             self.penalty.fetch_add(1, SeqCst);
-            return Ok(vec![ReplyType::Server((
-                ERR_NOTREGISTERED,
-                format!("* :{}", NOT_REGISTERED),
-            ))])
+            return Ok(vec![ReplyType::Server((ERR_NOTREGISTERED, format!("* :{NOT_REGISTERED}")))])
         }
 
         let mut tokens = args.split_ascii_whitespace();
@@ -663,10 +619,7 @@ impl Client {
     pub async fn handle_cmd_privmsg(&self, args: &str) -> Result<Vec<ReplyType>> {
         if !self.registered.load(SeqCst) {
             self.penalty.fetch_add(1, SeqCst);
-            return Ok(vec![ReplyType::Server((
-                ERR_NOTREGISTERED,
-                format!("* :{}", NOT_REGISTERED),
-            ))])
+            return Ok(vec![ReplyType::Server((ERR_NOTREGISTERED, format!("* :{NOT_REGISTERED}")))])
         }
 
         let nick = self.nickname.read().await.to_string();
@@ -675,21 +628,21 @@ impl Client {
         let Some(target) = tokens.next() else {
             return Ok(vec![ReplyType::Server((
                 ERR_NORECIPIENT,
-                format!("{} :No recipient given (PRIVMSG)", nick),
+                format!("{nick} :No recipient given (PRIVMSG)"),
             ))])
         };
 
         let Some(message) = tokens.next() else {
             return Ok(vec![ReplyType::Server((
                 ERR_NOTEXTTOSEND,
-                format!("{} :No text to send", nick),
+                format!("{nick} :No text to send"),
             ))])
         };
 
         if !message.starts_with(':') || (message.trim() == ":" && tokens.next().is_none()) {
             return Ok(vec![ReplyType::Server((
                 ERR_NOTEXTTOSEND,
-                format!("{} :No text to send", nick),
+                format!("{nick} :No text to send"),
             ))])
         }
 
@@ -700,7 +653,7 @@ impl Client {
         if target == nick {
             return Ok(vec![ReplyType::Client((
                 target.to_string(),
-                format!("PRIVMSG {} {}", target, message),
+                format!("PRIVMSG {target} {message}"),
             ))])
         }
 
@@ -712,7 +665,7 @@ impl Client {
         // If it's a DM and we don't have an encryption key, we will
         // refuse to send it. Send ERR_NORECIPIENT to the client.
         if !target.starts_with('#') && !self.server.contacts.read().await.contains_key(target) {
-            return Ok(vec![ReplyType::Server((ERR_NOSUCHNICK, format!("{} :{}", nick, target)))])
+            return Ok(vec![ReplyType::Server((ERR_NOSUCHNICK, format!("{nick} :{target}")))])
         }
 
         Ok(vec![])
@@ -724,7 +677,7 @@ impl Client {
     pub async fn handle_cmd_rehash(&self, _args: &str) -> Result<Vec<ReplyType>> {
         info!("Attempting to rehash server...");
         if let Err(e) = self.server.rehash().await {
-            error!("Failed to rehash server: {}", e);
+            error!("Failed to rehash server: {e}");
         }
 
         Ok(vec![ReplyType::Server((RPL_REHASHING, "Config reloaded!".to_string()))])
@@ -737,10 +690,7 @@ impl Client {
     pub async fn handle_cmd_topic(&self, args: &str) -> Result<Vec<ReplyType>> {
         if !self.registered.load(SeqCst) {
             self.penalty.fetch_add(1, SeqCst);
-            return Ok(vec![ReplyType::Server((
-                ERR_NOTREGISTERED,
-                format!("* :{}", NOT_REGISTERED),
-            ))])
+            return Ok(vec![ReplyType::Server((ERR_NOTREGISTERED, format!("* :{NOT_REGISTERED}")))])
         }
 
         let nick = self.nickname.read().await.to_string();
@@ -750,14 +700,14 @@ impl Client {
             self.penalty.fetch_add(1, SeqCst);
             return Ok(vec![ReplyType::Server((
                 ERR_NEEDMOREPARAMS,
-                format!("{} TOPIC :{}", nick, INVALID_SYNTAX),
+                format!("{nick} TOPIC :{INVALID_SYNTAX}"),
             ))])
         };
 
         if !self.server.channels.read().await.contains_key(channel) {
             return Ok(vec![ReplyType::Server((
                 ERR_NOSUCHCHANNEL,
-                format!("{} {} :No such channel", nick, channel),
+                format!("{nick} {channel} :No such channel"),
             ))])
         }
 
@@ -767,12 +717,12 @@ impl Client {
             if topic.is_empty() {
                 return Ok(vec![ReplyType::Server((
                     RPL_NOTOPIC,
-                    format!("{} {} :No topic is set", nick, channel),
+                    format!("{nick} {channel} :No topic is set"),
                 ))])
             } else {
                 return Ok(vec![ReplyType::Server((
                     RPL_TOPIC,
-                    format!("{} {} :{}", nick, channel, topic),
+                    format!("{nick} {channel} :{topic}"),
                 ))])
             }
         };
@@ -782,7 +732,7 @@ impl Client {
             topic.strip_prefix(':').unwrap().to_string();
 
         // Send reply
-        let replies = vec![ReplyType::Client((nick, format!("TOPIC {} {}", channel, topic)))];
+        let replies = vec![ReplyType::Client((nick, format!("TOPIC {channel} {topic}")))];
 
         Ok(replies)
     }
@@ -798,7 +748,7 @@ impl Client {
             self.penalty.fetch_add(1, SeqCst);
             return Ok(vec![ReplyType::Server((
                 ERR_ALREADYREGISTERED,
-                format!("{} :{}", self.nickname.read().await, ALREADY_REGISTERED),
+                format!("{} :{ALREADY_REGISTERED}", self.nickname.read().await),
             ))])
         }
 
@@ -815,7 +765,7 @@ impl Client {
             self.penalty.fetch_add(1, SeqCst);
             return Ok(vec![ReplyType::Server((
                 ERR_NEEDMOREPARAMS,
-                format!("{} USER :{}", nick, INVALID_SYNTAX),
+                format!("{nick} USER :{INVALID_SYNTAX}"),
             ))])
         };
 
@@ -824,7 +774,7 @@ impl Client {
             self.penalty.fetch_add(1, SeqCst);
             return Ok(vec![ReplyType::Server((
                 ERR_NEEDMOREPARAMS,
-                format!("{} USER :{}", nick, INVALID_SYNTAX),
+                format!("{nick} USER :{INVALID_SYNTAX}"),
             ))])
         };
 
@@ -833,7 +783,7 @@ impl Client {
             self.penalty.fetch_add(1, SeqCst);
             return Ok(vec![ReplyType::Server((
                 ERR_NEEDMOREPARAMS,
-                format!("{} USER :{}", nick, INVALID_SYNTAX),
+                format!("{nick} USER :{INVALID_SYNTAX}"),
             ))])
         };
 
@@ -842,7 +792,7 @@ impl Client {
             self.penalty.fetch_add(1, SeqCst);
             return Ok(vec![ReplyType::Server((
                 ERR_NEEDMOREPARAMS,
-                format!("{} USER :{}", nick, INVALID_SYNTAX),
+                format!("{nick} USER :{INVALID_SYNTAX}"),
             ))])
         };
 
@@ -850,7 +800,7 @@ impl Client {
             self.penalty.fetch_add(1, SeqCst);
             return Ok(vec![ReplyType::Server((
                 ERR_NEEDMOREPARAMS,
-                format!("{} USER :{}", nick, INVALID_SYNTAX),
+                format!("{nick} USER :{INVALID_SYNTAX}"),
             ))])
         }
 
@@ -862,7 +812,7 @@ impl Client {
             if !self.is_pass_set.load(SeqCst) {
                 return Ok(vec![ReplyType::Server((
                     ERR_PASSWDMISMATCH,
-                    format!("{} PASS :{}", nick, PASSWORD_MISMATCH),
+                    format!("{nick} PASS :{PASSWORD_MISMATCH}"),
                 ))])
             }
             self.registered.store(true, SeqCst);
@@ -883,19 +833,15 @@ impl Client {
     pub async fn handle_cmd_version(&self, _args: &str) -> Result<Vec<ReplyType>> {
         if !self.registered.load(SeqCst) {
             self.penalty.fetch_add(1, SeqCst);
-            return Ok(vec![ReplyType::Server((
-                ERR_NOTREGISTERED,
-                format!("* :{}", NOT_REGISTERED),
-            ))])
+            return Ok(vec![ReplyType::Server((ERR_NOTREGISTERED, format!("* :{NOT_REGISTERED}")))])
         }
 
         let replies = vec![ReplyType::Server((
             RPL_VERSION,
             format!(
-                "{} {} {} :Let there be dark!",
+                "{} {} {SERVER_NAME} :Let there be dark!",
                 self.nickname.read().await,
-                env!("CARGO_PKG_VERSION"),
-                SERVER_NAME
+                env!("CARGO_PKG_VERSION")
             ),
         ))];
 
@@ -907,12 +853,11 @@ impl Client {
         let nick = self.nickname.read().await.to_string();
 
         let mut replies = vec![
-            ReplyType::Server((RPL_WELCOME, format!("{} :{}", nick, WELCOME))),
+            ReplyType::Server((RPL_WELCOME, format!("{nick} :{WELCOME}"))),
             ReplyType::Server((
                 RPL_YOURHOST,
                 format!(
-                    "{} :Your host is irc.dark.fi, running version {}",
-                    nick,
+                    "{nick} :Your host is irc.dark.fi, running version {}",
                     env!("CARGO_PKG_VERSION")
                 ),
             )),
@@ -943,13 +888,13 @@ impl Client {
 
                     replies.push(ReplyType::Server((
                         RPL_NAMREPLY,
-                        format!("{} = {} :{}", nick, channel, nicks.join(" ")),
+                        format!("{nick} = {channel} :{}", nicks.join(" ")),
                     )));
                 }
 
                 replies.push(ReplyType::Server((
                     RPL_ENDOFNAMES,
-                    format!("{} {} :End of NAMES list", nick, channel),
+                    format!("{nick} {channel} :End of NAMES list"),
                 )));
             }
         }
@@ -980,7 +925,7 @@ impl Client {
                 Ok(true) => continue,
                 Ok(false) => {}
                 Err(e) => {
-                    error!("[IRC CLIENT] (get_history) self.is_seen({}) failed: {}", event_id, e);
+                    error!("[IRC CLIENT] (get_history) self.is_seen({event_id}) failed: {e}");
                     return Err(e)
                 }
             }
@@ -1021,7 +966,7 @@ impl Client {
                 }
 
                 // Format the message
-                let msg = format!("PRIVMSG {} :{}", privmsg.channel, line);
+                let msg = format!("PRIVMSG {} :{line}", privmsg.channel);
 
                 // Send it to the client
                 replies.push(ReplyType::Client((privmsg.nick.clone(), msg)));
@@ -1029,7 +974,7 @@ impl Client {
 
             // Mark the message as seen for this USER
             if let Err(e) = self.mark_seen(&event_id).await {
-                error!("[IRC CLIENT] (get_history) self.mark_seen({}) failed: {}", event_id, e);
+                error!("[IRC CLIENT] (get_history) self.mark_seen({event_id}) failed: {e}");
                 return Err(e)
             }
         }

+ 13 - 13
bin/darkirc/src/irc/server.rs

@@ -236,7 +236,7 @@ impl IrcServer {
         let contents = match toml::from_str(&contents) {
             Ok(v) => v,
             Err(e) => {
-                error!("Failed parsing TOML config: {}", e);
+                error!("Failed parsing TOML config: {e}");
                 return Err(Error::ParseFailed("Failed parsing TOML config"))
             }
         };
@@ -282,13 +282,13 @@ impl IrcServer {
                 Err(e) if e.raw_os_error().is_some() => match e.raw_os_error().unwrap() {
                     libc::EAGAIN | libc::ECONNABORTED | libc::EPROTO | libc::EINTR => continue,
                     _ => {
-                        error!("[IRC SERVER] Failed accepting connection: {}", e);
+                        error!("[IRC SERVER] Failed accepting connection: {e}");
                         return Err(e.into())
                     }
                 },
 
                 Err(e) => {
-                    error!("[IRC SERVER] Failed accepting new connection: {}", e);
+                    error!("[IRC SERVER] Failed accepting new connection: {e}");
                     continue
                 }
             };
@@ -299,7 +299,7 @@ impl IrcServer {
                     let stream = match acceptor.accept(stream).await {
                         Ok(s) => s,
                         Err(e) => {
-                            error!("[IRC SERVER] Failed accepting new TLS connection: {}", e);
+                            error!("[IRC SERVER] Failed accepting new TLS connection: {e}");
                             continue
                         }
                     };
@@ -311,7 +311,7 @@ impl IrcServer {
                         .process_connection(stream, peer_addr, incoming, ex.clone())
                         .await
                     {
-                        error!("[IRC SERVER] Failed processing new connection: {}", e);
+                        error!("[IRC SERVER] Failed processing new connection: {e}");
                         continue
                     };
                 }
@@ -325,13 +325,13 @@ impl IrcServer {
                         .process_connection(stream, peer_addr, incoming, ex.clone())
                         .await
                     {
-                        error!("[IRC SERVER] Failed processing new connection: {}", e);
+                        error!("[IRC SERVER] Failed processing new connection: {e}");
                         continue
                     };
                 }
             }
 
-            info!("[IRC SERVER] Accepted new client connection at: {}", peer_addr);
+            info!("[IRC SERVER] Accepted new client connection at: {peer_addr}");
         }
     }
 
@@ -355,8 +355,8 @@ impl IrcServer {
             async move { client.multiplex_connection(stream).await },
             move |res| async move {
                 match res {
-                    Ok(()) => info!("[IRC SERVER] Disconnected client from {}", peer_addr),
-                    Err(e) => error!("[IRC SERVER] Disconnected client from {}: {}", peer_addr, e),
+                    Ok(()) => info!("[IRC SERVER] Disconnected client from {peer_addr}"),
+                    Err(e) => error!("[IRC SERVER] Disconnected client from {peer_addr}: {e}"),
                 }
 
                 self.clone().clients.lock().await.remove(&port);
@@ -391,7 +391,7 @@ impl IrcServer {
                 // We will pad the name to MAX_NICK_LEN so they all look the same
                 *privmsg.nick() = saltbox::encrypt(saltbox, &Self::pad(privmsg.nick()));
                 *privmsg.msg() = saltbox::encrypt(saltbox, privmsg.msg().as_bytes());
-                debug!("Successfully encrypted message for {}", name);
+                debug!("Successfully encrypted message for {name}");
                 return
             }
         };
@@ -404,7 +404,7 @@ impl IrcServer {
             // so we can identify our messages.
             *privmsg.nick() = saltbox::encrypt(&contact.self_saltbox, &[0x00; MAX_NICK_LEN]);
             *privmsg.msg() = saltbox::encrypt(&contact.saltbox, privmsg.msg().as_bytes());
-            debug!("Successfully encrypted message for {}", name);
+            debug!("Successfully encrypted message for {name}");
         };
     }
 
@@ -451,7 +451,7 @@ impl IrcServer {
             privmsg.channel = name.to_string();
             privmsg.nick = String::from_utf8_lossy(&nick_dec).into();
             privmsg.msg = String::from_utf8_lossy(&msg_dec).into();
-            debug!("Successfully decrypted message for {}", name);
+            debug!("Successfully decrypted message for {name}");
             return
         }
 
@@ -476,7 +476,7 @@ impl IrcServer {
             privmsg.channel = name.to_string();
             privmsg.nick = nick;
             privmsg.msg = String::from_utf8_lossy(&msg_dec).into();
-            debug!("Successfully decrypted message from {}", name);
+            debug!("Successfully decrypted message from {name}");
             return
         }
     }

+ 9 - 12
bin/darkirc/src/irc/services/nickserv.rs

@@ -82,7 +82,7 @@ impl NickServ {
         let Some(command) = tokens.next() else {
             return Ok(vec![ReplyType::Server((
                 ERR_NOTEXTTOSEND,
-                format!("{} :No text to send", nick),
+                format!("{nick} :No text to send"),
             ))])
         };
 
@@ -143,11 +143,8 @@ impl NickServ {
         let leaf_pos = leaf_pos.unwrap();
 
         // Open the sled tree
-        let db = self
-            .server
-            .darkirc
-            .sled
-            .open_tree(format!("{}{}", ACCOUNTS_DB_PREFIX, account_name))?;
+        let db =
+            self.server.darkirc.sled.open_tree(format!("{ACCOUNTS_DB_PREFIX}{account_name}"))?;
 
         if !db.is_empty() {
             return Ok(vec![ReplyType::Notice((
@@ -165,7 +162,7 @@ impl NickServ {
                 return Ok(vec![ReplyType::Notice((
                     "NickServ".to_string(),
                     nick.to_string(),
-                    format!("Invalid identity_nullifier: {}", e),
+                    format!("Invalid identity_nullifier: {e}"),
                 ))])
             }
         };
@@ -176,7 +173,7 @@ impl NickServ {
                 return Ok(vec![ReplyType::Notice((
                     "NickServ".to_string(),
                     nick.to_string(),
-                    format!("Invalid identity_trapdoor: {}", e),
+                    format!("Invalid identity_trapdoor: {e}"),
                 ))])
             }
         };
@@ -187,7 +184,7 @@ impl NickServ {
                 return Ok(vec![ReplyType::Notice((
                     "NickServ".to_string(),
                     nick.to_string(),
-                    format!("Invalid leaf_pos: {}", e),
+                    format!("Invalid leaf_pos: {e}"),
                 ))])
             }
         };
@@ -200,7 +197,7 @@ impl NickServ {
         Ok(vec![ReplyType::Notice((
             "NickServ".to_string(),
             nick.to_string(),
-            format!("Successfully registered account \"{}\"", account_name),
+            format!("Successfully registered account \"{account_name}\""),
         ))])
     }
 
@@ -219,12 +216,12 @@ impl NickServ {
         };
 
         // Drop the tree
-        self.server.darkirc.sled.drop_tree(format!("{}{}", ACCOUNTS_DB_PREFIX, account_name))?;
+        self.server.darkirc.sled.drop_tree(format!("{ACCOUNTS_DB_PREFIX}{account_name}"))?;
 
         Ok(vec![ReplyType::Notice((
             "NickServ".to_string(),
             nick.to_string(),
-            format!("Successfully deregistered account \"{}\"", account_name),
+            format!("Successfully deregistered account \"{account_name}\""),
         ))])
     }
 

+ 19 - 19
bin/darkirc/src/main.rs

@@ -201,8 +201,8 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         );
         println!("[contact.\"satoshi\"]");
         println!("dm_chacha_public = \"YOUR_CONTACT_PUBLIC_KEY\"");
-        println!("my_dm_chacha_secret = \"{}\"", secret);
-        println!("#my_dm_chacha_public = \"{}\"", public);
+        println!("my_dm_chacha_secret = \"{secret}\"");
+        println!("#my_dm_chacha_public = \"{public}\"");
         return Ok(());
     }
 
@@ -211,7 +211,7 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         let secret = bs58::encode(secret.to_bytes()).into_string();
         println!("Place this in your config file:\n");
         println!("[channel.\"#yourchannelname\"]");
-        println!("secret = \"{}\"", secret);
+        println!("secret = \"{secret}\"");
         return Ok(());
     }
 
@@ -221,8 +221,8 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         let trapdoor = bs58::encode(identity.trapdoor.to_repr()).into_string();
         println!("Place this in your config file:\n");
         println!("[rln]");
-        println!("nullifier = \"{}\"", nullifier);
-        println!("trapdoor = \"{}\"", trapdoor);
+        println!("nullifier = \"{nullifier}\"");
+        println!("trapdoor = \"{trapdoor}\"");
         return Ok(());
     }
 
@@ -230,7 +230,7 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         let bytes = match bs58::decode(chacha_secret).into_vec() {
             Ok(v) => v,
             Err(e) => {
-                println!("Error: {}", e);
+                println!("Error: {e}");
                 return Err(Error::ParseFailed("Secret key parsing failed"));
             }
         };
@@ -249,21 +249,21 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         let config_path = match get_config_path(args.config, CONFIG_FILE) {
             Ok(path) => path,
             Err(e) => {
-                error!("Unable to get config path: {}", e);
+                error!("Unable to get config path: {e}");
                 return Err(e);
             }
         };
         let contents = match fs::read_to_string(&config_path).await {
             Ok(c) => c,
             Err(e) => {
-                error!("Unable read path `{config_path:?}`: {}", e);
+                error!("Unable read path `{config_path:?}`: {e}");
                 return Err(e.into());
             }
         };
         let contents = match toml::from_str(&contents) {
             Ok(v) => v,
             Err(e) => {
-                error!("Failed parsing TOML config: {}", e);
+                error!("Failed parsing TOML config: {e}");
                 return Err(Error::ParseFailed("Failed parsing TOML config"));
             }
         };
@@ -272,7 +272,7 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         let contacts = match list_configured_contacts(&contents) {
             Ok(c) => c,
             Err(e) => {
-                error!("List contacts failed `{config_path:?}`: {}", e);
+                error!("List contacts failed `{config_path:?}`: {e}");
                 return Err(e);
             }
         };
@@ -388,14 +388,14 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
             let dnet_sub = p2p_.dnet_subscribe().await;
             loop {
                 let event = dnet_sub.receive().await;
-                debug!("Got dnet event: {:?}", event);
+                debug!("Got dnet event: {event:?}");
                 dnet_sub_.notify(vec![event.into()].into()).await;
             }
         },
         |res| async {
             match res {
                 Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
-                Err(e) => panic!("{}", e),
+                Err(e) => panic!("{e}"),
             }
         },
         Error::DetachedTaskStopped,
@@ -412,14 +412,14 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
             let deg_sub = event_graph_.deg_subscribe().await;
             loop {
                 let event = deg_sub.receive().await;
-                debug!("Got deg event: {:?}", event);
+                debug!("Got deg event: {event:?}");
                 deg_sub_.notify(vec![event.into()].into()).await;
             }
         },
         |res| async {
             match res {
                 Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
-                Err(e) => panic!("{}", e),
+                Err(e) => panic!("{e}"),
             }
         },
         Error::DetachedTaskStopped,
@@ -443,7 +443,7 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         |res| async move {
             match res {
                 Ok(()) | Err(Error::RpcServerStopped) => darkirc_.stop_connections().await,
-                Err(e) => error!("Failed stopping JSON-RPC server: {}", e),
+                Err(e) => error!("Failed stopping JSON-RPC server: {e}"),
             }
         },
         Error::RpcServerStopped,
@@ -483,7 +483,7 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         |res| async move {
             match res {
                 Ok(()) | Err(Error::DetachedTaskStopped) => { /* TODO: */ }
-                Err(e) => error!("Failed stopping IRC server: {}", e),
+                Err(e) => error!("Failed stopping IRC server: {e}"),
             }
         },
         Error::DetachedTaskStopped,
@@ -509,7 +509,7 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         |res| async move {
             match res {
                 Ok(()) | Err(Error::DetachedTaskStopped) => { /* TODO: */ }
-                Err(e) => error!("Failed sync task: {}", e),
+                Err(e) => error!("Failed sync task: {e}"),
             }
         },
         Error::DetachedTaskStopped,
@@ -535,7 +535,7 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
 
     info!("Flushing sled database...");
     let flushed_bytes = sled_db.flush_async().await?;
-    info!("Flushed {} bytes", flushed_bytes);
+    info!("Flushed {flushed_bytes} bytes");
 
     info!("Shut down successfully");
     Ok(())
@@ -561,7 +561,7 @@ async fn sync_task(p2p: &P2pPtr, event_graph: &EventGraphPtr, skip_dag_sync: boo
                     Err(e) => {
                         // TODO: Maybe at this point we should prune or something?
                         // TODO: Or maybe just tell the user to delete the DAG from FS.
-                        error!("Failed syncing DAG ({}), retrying in {}s...", e, comms_timeout);
+                        error!("Failed syncing DAG ({e}), retrying in {comms_timeout}s...");
                         sleep(comms_timeout).await;
                     }
                 }

+ 4 - 4
bin/darkirc/src/settings.rs

@@ -154,7 +154,7 @@ pub fn parse_configured_contacts(data: &toml::Value) -> Result<HashMap<String, I
             return Err(ParseFailed("Duplicate contact found"))
         }
 
-        info!("Instantiated ChaChaBox for contact \"{}\"", name);
+        info!("Instantiated ChaChaBox for contact \"{name}\"");
         ret.insert(name.to_string(), IrcContact { saltbox, self_saltbox });
     }
 
@@ -263,7 +263,7 @@ pub fn parse_configured_channels(data: &toml::Value) -> Result<HashMap<String, I
 
         if let Some(topic) = items.get("topic") {
             if let Some(topic) = topic.as_str() {
-                info!("Found configured topic for {}: {}", name, topic);
+                info!("Found configured topic for {name}: {topic}");
                 chan.topic = topic.to_string();
             } else {
                 return Err(ParseFailed("Channel topic not a string"))
@@ -284,13 +284,13 @@ pub fn parse_configured_channels(data: &toml::Value) -> Result<HashMap<String, I
                 let secret = crypto_box::SecretKey::from(secret_bytes);
                 let public = secret.public_key();
                 chan.saltbox = Some(Arc::new(crypto_box::ChaChaBox::new(&public, &secret)));
-                info!("Configured NaCl box for channel {}", name);
+                info!("Configured NaCl box for channel {name}");
             } else {
                 return Err(ParseFailed("Channel secret not a string"))
             }
         }
 
-        info!("Configured channel {}", name);
+        info!("Configured channel {name}");
         ret.insert(name.to_string(), chan);
     }