aboutsummaryrefslogtreecommitdiff
path: root/planetwars-matchrunner/src/match_context.rs
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-03-13 15:20:03 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2022-03-13 15:20:03 +0100
commitfd52e266c6e25999a49c36f17342977b759a2612 (patch)
tree9c727cac949c9698343d003ee87cfe73c6c6204a /planetwars-matchrunner/src/match_context.rs
parentf7655005ff099e8314ecd31e95b26ad74d4efd02 (diff)
downloadplanetwars.dev-fd52e266c6e25999a49c36f17342977b759a2612.tar.xz
planetwars.dev-fd52e266c6e25999a49c36f17342977b759a2612.zip
apply clippy suggestions
Diffstat (limited to 'planetwars-matchrunner/src/match_context.rs')
-rw-r--r--planetwars-matchrunner/src/match_context.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/planetwars-matchrunner/src/match_context.rs b/planetwars-matchrunner/src/match_context.rs
index 6ea60c3..1dac09b 100644
--- a/planetwars-matchrunner/src/match_context.rs
+++ b/planetwars-matchrunner/src/match_context.rs
@@ -57,11 +57,11 @@ impl MatchCtx {
timeout,
});
- return Request {
+ Request {
player_id,
request_id,
event_bus: self.event_bus.clone(),
- };
+ }
}
pub fn players(&self) -> Vec<u32> {
@@ -97,6 +97,12 @@ impl EventBus {
}
}
+impl Default for EventBus {
+ fn default() -> Self {
+ EventBus::new()
+ }
+}
+
impl EventBus {
pub fn resolve_request(&mut self, id: RequestId, result: RequestResult<Vec<u8>>) {
if self.request_responses.contains_key(&id) {
@@ -138,9 +144,9 @@ impl Future for Request {
event_bus
.wakers
.entry(request_id)
- .or_insert_with(|| AtomicWaker::new())
+ .or_insert_with(AtomicWaker::new)
.register(cx.waker());
- return Poll::Pending;
+ Poll::Pending
}
}