Explorar el Código

fud: chore clippy

skoupidi hace 1 año
padre
commit
0f82f2fb4f

+ 20 - 28
bin/fud/fu/src/main.rs

@@ -127,7 +127,7 @@ impl Fu {
                 match res {
                     Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
                     Err(e) => {
-                        error!("{}", e);
+                        error!("{e}");
                         publisher_
                             .notify(JsonResult::Error(JsonError::new(
                                 ErrorCode::InternalError,
@@ -163,11 +163,8 @@ impl Fu {
             let remaining = progress_bar_width - completed;
             let bar = "=".repeat(completed) + &" ".repeat(remaining);
             print!(
-                "\x1B[2K\r[{}] {:.1}% | {}/{} chunks | ",
-                bar,
-                percent * 100.0,
-                chunks_downloaded,
-                chunks_total
+                "\x1B[2K\r[{bar}] {:.1}% | {chunks_downloaded}/{chunks_total} chunks | ",
+                percent * 100.0
             );
             tstdout.set_color(&status_to_colorspec(status)).unwrap();
             print!(
@@ -217,12 +214,12 @@ impl Fu {
                                 .unwrap();
                             let file_path = resource.get("path").unwrap().get::<String>().unwrap();
                             print_progress_bar(info);
-                            println!("\nDownload completed:\n{}", file_path);
+                            println!("\nDownload completed:\n{file_path}");
                             return Ok(());
                         }
                         "metadata_not_found" => {
                             println!();
-                            return Err(Error::Custom(format!("Could not find {}", file_hash)));
+                            return Err(Error::Custom(format!("Could not find {file_hash}")));
                         }
                         "chunk_not_found" => {
                             // A seeder does not have a chunk we are looking for,
@@ -264,7 +261,7 @@ impl Fu {
         let rep = self.rpc_client.request(req).await?;
         match rep {
             JsonValue::String(id) => {
-                println!("{}", id);
+                println!("{id}");
                 Ok(())
             }
             _ => Err(Error::ParseFailed("ID is not a string")),
@@ -290,20 +287,19 @@ impl Fu {
                 *resource.get("chunks_total").unwrap().get::<f64>().unwrap() as usize;
             let status = resource.get("status").unwrap().get::<String>().unwrap();
             tstdout.set_color(ColorSpec::new().set_bold(true)).unwrap();
-            println!("{}", path);
+            println!("{path}");
             tstdout.reset().unwrap();
-            println!("  ID: {}", hash);
+            println!("  ID: {hash}");
             print!("  Type: ");
             tstdout.set_color(&type_to_colorspec(rtype)).unwrap();
-            println!("{}", rtype);
+            println!("{rtype}");
             tstdout.reset().unwrap();
             print!("  Status: ");
             tstdout.set_color(&status_to_colorspec(status)).unwrap();
-            println!("{}", status);
+            println!("{status}");
             tstdout.reset().unwrap();
             println!(
-                "  Chunks: {}/{}",
-                chunks_downloaded,
+                "  Chunks: {chunks_downloaded}/{}",
                 match chunks_total {
                     0 => "?".to_string(),
                     _ => chunks_total.to_string(),
@@ -326,7 +322,7 @@ impl Fu {
             }
             empty = false;
 
-            println!("Bucket {}", bucket_i);
+            println!("Bucket {bucket_i}");
             for n in nodes.clone() {
                 let node: Vec<JsonValue> = n.try_into().unwrap();
                 let node_id: JsonValue = node[0].clone();
@@ -356,11 +352,11 @@ impl Fu {
             println!("No known seeders");
         } else {
             for (file_hash, node_ids) in files {
-                println!("{}", file_hash);
+                println!("{file_hash}");
                 let node_ids: Vec<JsonValue> = node_ids.try_into().unwrap();
                 for node_id in node_ids {
                     let node_id: String = node_id.try_into().unwrap();
-                    println!("\t{}", node_id);
+                    println!("\t{node_id}");
                 }
             }
         }
@@ -389,7 +385,7 @@ impl Fu {
                 match res {
                     Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
                     Err(e) => {
-                        error!("{}", e);
+                        error!("{e}");
                         publisher_
                             .notify(JsonResult::Error(JsonError::new(
                                 ErrorCode::InternalError,
@@ -428,16 +424,16 @@ impl Fu {
             print!("\x1b[{};1H\x1B[2K", i + 2);
 
             let hash = resource.get("hash").unwrap().get::<String>().unwrap();
-            print!("\r{:>44} ", hash);
+            print!("\r{hash:>44} ");
 
             let rtype = resource.get("type").unwrap().get::<String>().unwrap();
             tstdout.set_color(&type_to_colorspec(rtype)).unwrap();
-            print!("{:>9} ", rtype);
+            print!("{rtype:>9} ");
             tstdout.reset().unwrap();
 
             let status = resource.get("status").unwrap().get::<String>().unwrap();
             tstdout.set_color(&status_to_colorspec(status)).unwrap();
-            print!("{:>11} ", status);
+            print!("{status:>11} ");
             tstdout.reset().unwrap();
 
             let chunks_downloaded =
@@ -446,15 +442,11 @@ impl Fu {
                 *resource.get("chunks_total").unwrap().get::<f64>().unwrap() as usize;
             match chunks_total {
                 0 => {
-                    print!("{:>5.1} {:>9}", 0.0, format!("{}/?", chunks_downloaded));
+                    print!("{:>5.1} {:>9}", 0.0, format!("{chunks_downloaded}/?"));
                 }
                 _ => {
                     let percent = chunks_downloaded as f64 / chunks_total as f64 * 100.0;
-                    print!(
-                        "{:>5.1} {:>9}",
-                        percent,
-                        format!("{}/{}", chunks_downloaded, chunks_total)
-                    );
+                    print!("{:>5.1} {:>9}", percent, format!("{chunks_downloaded}/{chunks_total}"));
                 }
             };
             println!();

+ 28 - 28
bin/fud/fud/src/lib.rs

@@ -404,7 +404,7 @@ impl Fud {
                 }
             };
             if let Err(e) = self.geode.verify_chunks(&mut chunked).await {
-                error!(target: "fud::verify_resources()", "Error while verifying chunks of {}: {}", hash_to_string(&resource.hash), e);
+                error!(target: "fud::verify_resources()", "Error while verifying chunks of {}: {e}", hash_to_string(&resource.hash));
                 update_resource(&mut resource, ResourceStatus::Incomplete, None).await;
                 continue;
             }
@@ -432,7 +432,7 @@ impl Fud {
             let channel = match self.get_channel(node, None).await {
                 Ok(channel) => channel,
                 Err(e) => {
-                    warn!(target: "fud::fetch_seeders()", "Could not get a channel for node {}: {}", hash_to_string(&node.id), e);
+                    warn!(target: "fud::fetch_seeders()", "Could not get a channel for node {}: {e}", hash_to_string(&node.id));
                     continue;
                 }
             };
@@ -442,7 +442,7 @@ impl Fud {
             let msg_subscriber = match channel.subscribe_msg::<FudFindSeedersReply>().await {
                 Ok(msg_subscriber) => msg_subscriber,
                 Err(e) => {
-                    warn!(target: "fud::fetch_seeders()", "Error subscribing to msg: {}", e);
+                    warn!(target: "fud::fetch_seeders()", "Error subscribing to msg: {e}");
                     self.cleanup_channel(channel).await;
                     continue;
                 }
@@ -450,7 +450,7 @@ impl Fud {
 
             let send_res = channel.send(&FudFindSeedersRequest { key: *key }).await;
             if let Err(e) = send_res {
-                warn!(target: "fud::fetch_seeders()", "Error while sending FudFindSeedersRequest: {}", e);
+                warn!(target: "fud::fetch_seeders()", "Error while sending FudFindSeedersRequest: {e}");
                 msg_subscriber.unsubscribe().await;
                 self.cleanup_channel(channel).await;
                 continue;
@@ -460,7 +460,7 @@ impl Fud {
             {
                 Ok(reply) => reply,
                 Err(e) => {
-                    warn!(target: "fud::fetch_seeders()", "Error waiting for reply: {}", e);
+                    warn!(target: "fud::fetch_seeders()", "Error waiting for reply: {e}");
                     msg_subscriber.unsubscribe().await;
                     self.cleanup_channel(channel).await;
                     continue;
@@ -505,7 +505,7 @@ impl Fud {
             let channel = match self.get_channel(&seeder.node, Some(*hash)).await {
                 Ok(channel) => channel,
                 Err(e) => {
-                    warn!(target: "fud::fetch_missing_chunks()", "Could not get a channel for node {}: {}", hash_to_string(&seeder.node.id), e);
+                    warn!(target: "fud::fetch_missing_chunks()", "Could not get a channel for node {}: {e}", hash_to_string(&seeder.node.id));
                     continue;
                 }
             };
@@ -534,7 +534,7 @@ impl Fud {
                 let send_res =
                     channel.send(&FudFindRequest { info: Some(*hash), key: chunk_hash }).await;
                 if let Err(e) = send_res {
-                    warn!(target: "fud::fetch_missing_chunks()", "Error while sending FudFindRequest: {}", e);
+                    warn!(target: "fud::fetch_missing_chunks()", "Error while sending FudFindRequest: {e}");
                     break; // Switch to another seeder
                 }
 
@@ -549,7 +549,7 @@ impl Fud {
                 select! {
                     chunk_reply = chunk_recv => {
                         if let Err(e) = chunk_reply {
-                            warn!(target: "fud::fetch_missing_chunks()", "Error waiting for chunk reply: {}", e);
+                            warn!(target: "fud::fetch_missing_chunks()", "Error waiting for chunk reply: {e}");
                             break; // Switch to another seeder
                         }
                         let reply = chunk_reply.unwrap();
@@ -586,13 +586,13 @@ impl Fud {
                                 remaining_chunks.remove(&chunk_hash);
                             }
                             Err(e) => {
-                                error!(target: "fud::fetch_missing_chunks()", "Failed inserting chunk {} to Geode: {}", hash_to_string(&chunk_hash), e);
+                                error!(target: "fud::fetch_missing_chunks()", "Failed inserting chunk {} to Geode: {e}", hash_to_string(&chunk_hash));
                             }
                         };
                     }
                     notfound_reply = notfound_recv => {
                         if let Err(e) = notfound_reply {
-                            warn!(target: "fud::fetch_missing_chunks()", "Error waiting for NOTFOUND reply: {}", e);
+                            warn!(target: "fud::fetch_missing_chunks()", "Error waiting for NOTFOUND reply: {e}");
                             msg_subscriber_chunk.unsubscribe().await;
                             msg_subscriber_notfound.unsubscribe().await;
                             break; // Switch to another seeder
@@ -642,7 +642,7 @@ impl Fud {
             let channel = match self.get_channel(node, Some(*hash)).await {
                 Ok(channel) => channel,
                 Err(e) => {
-                    warn!(target: "fud::fetch_metadata()", "Could not get a channel for node {}: {}", hash_to_string(&node.id), e);
+                    warn!(target: "fud::fetch_metadata()", "Could not get a channel for node {}: {e}", hash_to_string(&node.id));
                     continue;
                 }
             };
@@ -652,14 +652,14 @@ impl Fud {
             let msg_subscriber = match channel.subscribe_msg::<FudFindSeedersReply>().await {
                 Ok(msg_subscriber) => msg_subscriber,
                 Err(e) => {
-                    warn!(target: "fud::fetch_metadata()", "Error subscribing to msg: {}", e);
+                    warn!(target: "fud::fetch_metadata()", "Error subscribing to msg: {e}");
                     continue;
                 }
             };
 
             let send_res = channel.send(&FudFindSeedersRequest { key: *hash }).await;
             if let Err(e) = send_res {
-                warn!(target: "fud::fetch_metadata()", "Error while sending FudFindSeedersRequest: {}", e);
+                warn!(target: "fud::fetch_metadata()", "Error while sending FudFindSeedersRequest: {e}");
                 msg_subscriber.unsubscribe().await;
                 self.cleanup_channel(channel).await;
                 continue;
@@ -669,7 +669,7 @@ impl Fud {
             {
                 Ok(reply) => reply,
                 Err(e) => {
-                    warn!(target: "fud::fetch_metadata()", "Error waiting for reply: {}", e);
+                    warn!(target: "fud::fetch_metadata()", "Error waiting for reply: {e}");
                     msg_subscriber.unsubscribe().await;
                     self.cleanup_channel(channel).await;
                     continue;
@@ -707,7 +707,7 @@ impl Fud {
 
                     let send_res = channel.send(&FudFindRequest { info: None, key: *hash }).await;
                     if let Err(e) = send_res {
-                        warn!(target: "fud::fetch_metadata()", "Error while sending FudFindRequest: {}", e);
+                        warn!(target: "fud::fetch_metadata()", "Error while sending FudFindRequest: {e}");
                         msg_subscriber_chunk.unsubscribe().await;
                         msg_subscriber_file.unsubscribe().await;
                         msg_subscriber_dir.unsubscribe().await;
@@ -742,7 +742,7 @@ impl Fud {
                         chunk_reply = chunk_recv => {
                             cleanup().await;
                             if let Err(e) = chunk_reply {
-                                warn!(target: "fud::fetch_metadata()", "Error waiting for chunk reply: {}", e);
+                                warn!(target: "fud::fetch_metadata()", "Error waiting for chunk reply: {e}");
                                 continue;
                             }
                             let reply = chunk_reply.unwrap();
@@ -759,7 +759,7 @@ impl Fud {
                         file_reply = file_recv => {
                             cleanup().await;
                             if let Err(e) = file_reply {
-                                warn!(target: "fud::fetch_metadata()", "Error waiting for file reply: {}", e);
+                                warn!(target: "fud::fetch_metadata()", "Error waiting for file reply: {e}");
                                 continue;
                             }
                             let reply = file_reply.unwrap();
@@ -774,7 +774,7 @@ impl Fud {
                         dir_reply = dir_recv => {
                             cleanup().await;
                             if let Err(e) = dir_reply {
-                                warn!(target: "fud::fetch_metadata()", "Error waiting for directory reply: {}", e);
+                                warn!(target: "fud::fetch_metadata()", "Error waiting for directory reply: {e}");
                                 continue;
                             }
                             let reply = dir_reply.unwrap();
@@ -795,7 +795,7 @@ impl Fud {
                         notfound_reply = notfound_recv => {
                             cleanup().await;
                             if let Err(e) = notfound_reply {
-                                warn!(target: "fud::fetch_metadata()", "Error waiting for NOTFOUND reply: {}", e);
+                                warn!(target: "fud::fetch_metadata()", "Error waiting for NOTFOUND reply: {e}");
                                 continue;
                             }
                             info!(target: "fud::fetch_metadata()", "Received NOTFOUND {} from seeder {}", hash_to_string(hash), hash_to_string(&seeder.node.id));
@@ -826,13 +826,13 @@ impl Fud {
 
                 self.geode.sort_files(&mut files);
                 if let Err(e) = self.geode.insert_metadata(hash, &chunk_hashes, &files).await {
-                    error!(target: "fud::fetch_metadata()", "Failed inserting directory {} to Geode: {}", hash_to_string(hash), e);
+                    error!(target: "fud::fetch_metadata()", "Failed inserting directory {} to Geode: {e}", hash_to_string(hash));
                     return Err(e)
                 }
             }
             FetchReply::File(FudFileReply { chunk_hashes }) => {
                 if let Err(e) = self.geode.insert_metadata(hash, &chunk_hashes, &[]).await {
-                    error!(target: "fud::fetch_metadata()", "Failed inserting file {} to Geode: {}", hash_to_string(hash), e);
+                    error!(target: "fud::fetch_metadata()", "Failed inserting file {} to Geode: {e}", hash_to_string(hash));
                     return Err(e)
                 }
             }
@@ -847,7 +847,7 @@ impl Fud {
                     false,
                 );
                 if let Err(e) = self.geode.write_chunk(&mut chunked_file, &chunk).await {
-                    error!(target: "fud::fetch_metadata()", "Failed inserting chunk {} to Geode: {}", hash_to_string(&chunk_hash), e);
+                    error!(target: "fud::fetch_metadata()", "Failed inserting chunk {} to Geode: {e}", hash_to_string(&chunk_hash));
                     return Err(e)
                 };
             }
@@ -887,7 +887,7 @@ impl Fud {
         for path_item in self.path_tree.iter() {
             let (key, value) = path_item?;
             if key != hash_bytes && value == path_bytes {
-                let err_str = format!("There is already another resource on path {}", path_string);
+                let err_str = format!("There is already another resource on path {path_string}");
                 self.event_publisher
                     .notify(FudEvent::DownloadError(event::DownloadError {
                         hash: *hash,
@@ -956,7 +956,7 @@ impl Fud {
             }
 
             Err(e) => {
-                error!(target: "fud::handle_get()", "{}", e);
+                error!(target: "fud::handle_get()", "{e}");
                 return Err(e);
             }
         };
@@ -992,7 +992,7 @@ impl Fud {
 
         // Mark locally available chunks as such
         if let Err(e) = self.geode.verify_chunks(&mut chunked).await {
-            error!(target: "self::get()", "Error while verifying chunks: {}", e);
+            error!(target: "self::get()", "Error while verifying chunks: {e}");
             return Err(e);
         }
 
@@ -1092,7 +1092,7 @@ impl Fud {
         let mut chunked = match self.geode.get(hash, path).await {
             Ok(v) => v,
             Err(e) => {
-                error!(target: "fud::handle_get()", "{}", e);
+                error!(target: "fud::handle_get()", "{e}");
                 return Err(e);
             }
         };
@@ -1210,7 +1210,7 @@ impl Fud {
 
         // Create the metadata file in geode
         if let Err(e) = self.geode.insert_metadata(&hash, &chunk_hashes, &relative_files).await {
-            error!(target: "fud::put()", "Failed inserting {:?} to geode: {}", path, e);
+            error!(target: "fud::put()", "Failed inserting {path:?} to geode: {e}");
             return Err(e)
         }
 
@@ -1218,7 +1218,7 @@ impl Fud {
         if let Err(e) =
             self.path_tree.insert(hash.as_bytes(), path.to_string_lossy().to_string().as_bytes())
         {
-            error!(target: "fud::put()", "Failed inserting new resource into sled: {}", e);
+            error!(target: "fud::put()", "Failed inserting new resource into sled: {e}");
             return Err(e.into())
         }
 

+ 10 - 10
bin/fud/fud/src/main.rs

@@ -119,14 +119,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,
@@ -165,14 +165,14 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
             let event_sub = event_pub.clone().subscribe().await;
             loop {
                 let event = event_sub.receive().await;
-                debug!(target: "fud", "Got event: {:?}", event);
+                debug!(target: "fud", "Got event: {event:?}");
                 event_sub_.notify(event.into()).await;
             }
         },
         |res| async {
             match res {
                 Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
-                Err(e) => panic!("{}", e),
+                Err(e) => panic!("{e}"),
             }
         },
         Error::DetachedTaskStopped,
@@ -186,7 +186,7 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         |res| async {
             match res {
                 Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
-                Err(e) => error!(target: "fud", "Failed starting get task: {}", e),
+                Err(e) => error!(target: "fud", "Failed starting get task: {e}"),
             }
         },
         Error::DetachedTaskStopped,
@@ -203,7 +203,7 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         |res| async move {
             match res {
                 Ok(()) | Err(Error::RpcServerStopped) => rpc_interface_.stop_connections().await,
-                Err(e) => error!(target: "fud", "Failed starting sync JSON-RPC server: {}", e),
+                Err(e) => error!(target: "fud", "Failed starting sync JSON-RPC server: {e}"),
             }
         },
         Error::RpcServerStopped,
@@ -236,7 +236,7 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         |res| async {
             match res {
                 Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
-                Err(e) => error!(target: "fud", "Failed starting dht channel task: {}", e),
+                Err(e) => error!(target: "fud", "Failed starting dht channel task: {e}"),
             }
         },
         Error::DetachedTaskStopped,
@@ -249,7 +249,7 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         |res| async {
             match res {
                 Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
-                Err(e) => error!(target: "fud", "Failed starting dht disconnect task: {}", e),
+                Err(e) => error!(target: "fud", "Failed starting dht disconnect task: {e}"),
             }
         },
         Error::DetachedTaskStopped,
@@ -262,7 +262,7 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         |res| async {
             match res {
                 Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
-                Err(e) => error!(target: "fud", "Failed starting announce task: {}", e),
+                Err(e) => error!(target: "fud", "Failed starting announce task: {e}"),
             }
         },
         Error::DetachedTaskStopped,
@@ -293,7 +293,7 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
 
     info!(target: "fud", "Flushing sled database...");
     let flushed_bytes = sled_db.flush_async().await?;
-    info!(target: "fud", "Flushed {} bytes", flushed_bytes);
+    info!(target: "fud", "Flushed {flushed_bytes} bytes");
 
     info!(target: "fud", "Shut down successfully");
     Ok(())

+ 6 - 6
bin/fud/fud/src/proto.rs

@@ -178,7 +178,7 @@ impl ProtocolFud {
                 Ok(v) => v,
                 Err(Error::ChannelStopped) => continue,
                 Err(e) => {
-                    error!("{}", e);
+                    error!("{e}");
                     continue
                 }
             };
@@ -200,7 +200,7 @@ impl ProtocolFud {
                 Ok(v) => v,
                 Err(Error::ChannelStopped) => continue,
                 Err(e) => {
-                    error!("{}", e);
+                    error!("{e}");
                     continue
                 }
             };
@@ -310,7 +310,7 @@ impl ProtocolFud {
                     })
                     .collect::<std::result::Result<Vec<_>, StripPrefixError>>();
                 if let Err(e) = files {
-                    error!(target: "fud::ProtocolFud::handle_fud_metadata_request()", "Error parsing file paths before sending directory metadata: {}", e);
+                    error!(target: "fud::ProtocolFud::handle_fud_metadata_request()", "Error parsing file paths before sending directory metadata: {e}");
                     return false;
                 }
                 let reply = FudDirectoryReply {
@@ -337,7 +337,7 @@ impl ProtocolFud {
                 Ok(v) => v,
                 Err(Error::ChannelStopped) => continue,
                 Err(e) => {
-                    error!("{}", e);
+                    error!("{e}");
                     continue
                 }
             };
@@ -366,7 +366,7 @@ impl ProtocolFud {
                 Ok(v) => v,
                 Err(Error::ChannelStopped) => continue,
                 Err(e) => {
-                    error!("{}", e);
+                    error!("{e}");
                     continue
                 }
             };
@@ -402,7 +402,7 @@ impl ProtocolFud {
                 Ok(v) => v,
                 Err(Error::ChannelStopped) => continue,
                 Err(e) => {
-                    error!("{}", e);
+                    error!("{e}");
                     continue
                 }
             };

+ 2 - 2
bin/fud/fud/src/rpc.rs

@@ -109,7 +109,7 @@ impl JsonRpcInterface {
         // add it to Geode.
         let res = self.fud.put(&path).await;
         if let Err(e) = res {
-            return JsonError::new(ErrorCode::InternalError, Some(format!("{}", e)), id).into()
+            return JsonError::new(ErrorCode::InternalError, Some(format!("{e}")), id).into()
         }
 
         JsonResponse::new(JsonValue::String(hash_to_string(&res.unwrap())), id).into()
@@ -340,7 +340,7 @@ impl JsonRpcInterface {
         };
 
         if let Err(e) = self.fud.verify_resources(hashes).await {
-            error!(target: "fud::verify()", "Could not verify resources: {}", e);
+            error!(target: "fud::verify()", "Could not verify resources: {e}");
             return JsonError::new(ErrorCode::InternalError, None, id).into();
         }
 

+ 2 - 2
bin/fud/fud/src/tasks.rs

@@ -63,7 +63,7 @@ pub async fn get_task(fud: Arc<Fud>, executor: ExecutorPtr) -> Result<()> {
                 match res {
                     Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
                     Err(e) => {
-                        error!(target: "fud::get_task()", "Error while fetching resource: {}", e)
+                        error!(target: "fud::get_task()", "Error while fetching resource: {e}")
                     }
                 }
             },
@@ -87,7 +87,7 @@ pub async fn announce_seed_task(fud: Arc<Fud>) -> Result<()> {
         let seeding_resources = match fud.verify_resources(None).await {
             Ok(resources) => resources,
             Err(e) => {
-                error!(target: "fud::announce_seed_task()", "Error while verifying seeding resources: {}", e);
+                error!(target: "fud::announce_seed_task()", "Error while verifying seeding resources: {e}");
                 continue;
             }
         };