Simplify code
authorunC0Rr
Thu, 06 Oct 2022 12:38:07 +0200
changeset 15883 8f2ddbfdc0b4
parent 15882 f185e7367dd3
child 15884 f9e1a7c8a658
Simplify code
rust/hedgewars-server/src/server/replaystorage.rs
--- a/rust/hedgewars-server/src/server/replaystorage.rs	Thu Sep 29 16:30:02 2022 +0200
+++ b/rust/hedgewars-server/src/server/replaystorage.rs	Thu Oct 06 12:38:07 2022 +0200
@@ -24,10 +24,9 @@
         let result = fs::read_dir("replays")
             .ok()?
             .flat_map(|f| Some(f.ok()?.path()))
-            .filter(|f| {
+            .find(|f| {
                 f.ends_with(&protocol_suffix) && !self.borrowed_replays.iter().any(|e| &e.path == f)
             })
-            .next()
             .and_then(|f| {
                 Some((
                     ReplayId { path: f.clone() },