Skip to content

Commit b728980

Browse files
committed
refactor: remove unnecessary semicolons and elide lifetimes
- Remove unnecessary semicolons after match and if expressions - Elide unnecessary explicit lifetime parameter in Visitor impl - Replace hand-coded IP address with Ipv4Addr::UNSPECIFIED constant Fixes clippy pedantic warnings
1 parent 971e9aa commit b728980

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/api/handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub async fn get_metainfo_file_handler(
6464
Err(err) => {
6565
error!("error adding torrent to cache: {}", err);
6666
}
67-
};
67+
}
6868

6969
torrent_file_response(
7070
bytes,

src/bit_torrent/info_hash.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ impl<'de> serde::de::Deserialize<'de> for InfoHash {
334334

335335
struct InfoHashVisitor;
336336

337-
impl<'v> serde::de::Visitor<'v> for InfoHashVisitor {
337+
impl serde::de::Visitor<'_> for InfoHashVisitor {
338338
type Value = InfoHash;
339339

340340
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@@ -356,7 +356,7 @@ impl<'v> serde::de::Visitor<'v> for InfoHashVisitor {
356356
serde::de::Unexpected::Str(v),
357357
&"a hexadecimal string",
358358
));
359-
};
359+
}
360360
Ok(res)
361361
}
362362
}

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async fn main() -> Result<(), anyhow::Error> {
1717

1818
let session_output_dir = "/var/lib/torrust/hash2torrent/session";
1919
let torrents_cache_dir = "/var/lib/torrust/hash2torrent/torrents";
20-
let bind_address = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 3000);
20+
let bind_address = SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), 3000);
2121

2222
let config = Config {
2323
api: config::Api {

0 commit comments

Comments
 (0)