aboutsummaryrefslogtreecommitdiff
path: root/planetwars-matchrunner/src/match_context.rs
diff options
context:
space:
mode:
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
}
}