aboutsummaryrefslogtreecommitdiff
path: root/server/src/entity
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2026-03-11 00:04:06 +0100
committermetamuffin <metamuffin@disroot.org>2026-03-11 00:04:06 +0100
commit185b08984ec63009b1be65959c903dc60ace5d9a (patch)
tree3375af48ce351c67e0227c22d35bfbee54d09792 /server/src/entity
parent1383cf5dac9d1471034ec491e122dfef6cf9999c (diff)
downloadhurrycurry-185b08984ec63009b1be65959c903dc60ace5d9a.tar
hurrycurry-185b08984ec63009b1be65959c903dc60ace5d9a.tar.bz2
hurrycurry-185b08984ec63009b1be65959c903dc60ace5d9a.tar.zst
clippy
Diffstat (limited to 'server/src/entity')
-rw-r--r--server/src/entity/ctf_minigame.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/server/src/entity/ctf_minigame.rs b/server/src/entity/ctf_minigame.rs
index f56e5648..c975821d 100644
--- a/server/src/entity/ctf_minigame.rs
+++ b/server/src/entity/ctf_minigame.rs
@@ -70,7 +70,7 @@ impl CtfMinigame {
}
fn setup(&mut self, c: &mut EntityContext) -> Result<(), TrError> {
- let mut players = c.game.players.iter_mut().map(|p| p);
+ let mut players = c.game.players.iter_mut();
'a: loop {
for (_, data) in self.teams.iter_mut() {
if let Some((&pid, player)) = players.next() {
@@ -92,7 +92,7 @@ impl CtfMinigame {
Ok(*self
.teams
.iter_mut()
- .find(|(_, d)| d.players.get(&pid).is_some())
+ .find(|(_, d)| d.players.contains(&pid))
.ok_or(TrError::Plain("Player is not in any team".to_string()))?
.0)
}
@@ -130,7 +130,7 @@ impl CtfMinigame {
let (_, team) = self
.teams
.iter()
- .find(|(_, d)| d.players.get(&pid).is_some())
+ .find(|(_, d)| d.players.contains(&pid))
.ok_or(TrError::Plain("Player is not in any team".to_string()))?;
c.game
.players
@@ -169,17 +169,17 @@ impl CtfMinigame {
for (item, _) in ti.clone() {
write!(o, "{:<20}|", c.game.data.item_name(*item)).unwrap();
}
- writeln!(o, "").unwrap();
+ writeln!(o).unwrap();
write!(o, "|").unwrap();
for (_, (s, _)) in ti.clone() {
write!(o, "{:<20}|", s).unwrap();
}
- writeln!(o, "").unwrap();
+ writeln!(o).unwrap();
write!(o, "|").unwrap();
for _ in ti.clone() {
write!(o, "{:-<20}|", "").unwrap();
}
- writeln!(o, "").unwrap();
+ writeln!(o).unwrap();
let max = self
.teams
.iter()
@@ -197,7 +197,7 @@ impl CtfMinigame {
write!(o, "{:<20}|", "").unwrap();
}
}
- writeln!(o, "").unwrap();
+ writeln!(o).unwrap();
}
c.packet_out.push_back(PacketC::ServerMessage {
error: false,
@@ -213,7 +213,7 @@ impl Entity for CtfMinigame {
self.setup(&mut c)?;
}
for (_, team) in self.teams.iter_mut() {
- team.players.retain(|pid| c.game.players.get(pid).is_some());
+ team.players.retain(|pid| c.game.players.contains_key(pid));
}
self.time += c.dt;
while self.time > 0. {
@@ -249,8 +249,7 @@ impl Entity for CtfMinigame {
.items
.iter()
.flatten()
- .find(|i| i.kind != from_team_idx)
- .is_some()
+ .any(|i| i.kind != from_team_idx)
&& c.game
.tiles
.get(&pos)