Skip to content

Commit fd95a52

Browse files
committed
clippy
1 parent 23d85e5 commit fd95a52

14 files changed

+20
-25
lines changed

server/src/ability_initializer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::card::HandCard;
2-
use crate::combat::{update_combat_strength, Combat};
2+
use crate::combat::{update_combat_strength, Combat};
33
use crate::combat_listeners::CombatStrength;
44
use crate::content::custom_phase_actions::{
55
AdvanceRequest, CurrentEventHandler, CurrentEventRequest, CurrentEventResponse,

server/src/combat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ pub(crate) fn update_combat_strength(
223223
game: &mut Game,
224224
player: usize,
225225
e: &mut CombatRoundStart,
226-
update: impl Fn(&mut Game, &Combat, &mut CombatStrength, CombatRole) + Clone + Sized,
226+
update: impl Fn(&mut Game, &Combat, &mut CombatStrength, CombatRole) + Clone,
227227
) {
228228
if player == e.combat.attacker {
229229
update(

server/src/combat_listeners.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::ability_initializer::AbilityInitializerSetup;
2-
use crate::combat::{capture_position, Combat, CombatRetreatState};
2+
use crate::combat::{capture_position, Combat, CombatRetreatState};
33
use crate::consts::SHIP_CAPACITY;
44
use crate::content::builtin::{Builtin, BuiltinBuilder};
55
use crate::content::custom_phase_actions::{new_position_request, CurrentEventType, UnitsRequest};
@@ -371,10 +371,7 @@ pub(crate) fn event_with_tactics<T: Clone + PartialEq>(
371371
),
372372
CombatRoundType::Done => panic!("Invalid round type"),
373373
};
374-
s = match option {
375-
None => return None,
376-
Some(e) => e,
377-
}
374+
s = option?;
378375
}
379376
*get_round_type(&mut s) = CombatRoundType::Done;
380377
Some(s)
@@ -463,8 +460,7 @@ pub(crate) fn offer_retreat() -> Builtin {
463460
game.add_info_log_item(&format!("{player_name} does not retreat",));
464461
}
465462
if retreat.choice {
466-
e.combat.retreat =
467-
CombatRetreatState::EndAfterCurrentRound;
463+
e.combat.retreat = CombatRetreatState::EndAfterCurrentRound;
468464
}
469465
},
470466
)

server/src/content/advances/economy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fn trade_routes() -> AdvanceBuilder {
7474
)
7575
})
7676
},
77-
|game, p, _| {
77+
|game, p, ()| {
7878
let (_, routes) =
7979
trade_route_reward(game).expect("No trade route reward");
8080
trade_route_log(game, p.player_index, &routes, &p.choice, p.actively_selected)

server/src/content/advances/warfare.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::city_pieces::Building::Fortress;
55
use crate::combat::CombatModifier::{
66
CancelFortressExtraDie, CancelFortressIgnoreHit, SteelWeaponsAttacker, SteelWeaponsDefender,
77
};
8-
use crate::combat::{ Combat, CombatModifier};
8+
use crate::combat::{Combat, CombatModifier};
99
use crate::combat_listeners::CombatStrength;
1010
use crate::content::advances::{
1111
advance_group_builder, AdvanceGroup, METALLURGY, STEEL_WEAPONS, TACTICS,

server/src/content/custom_phase_actions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl CurrentEventState {
217217
selected_position: None,
218218
}
219219
}
220-
220+
221221
#[must_use]
222222
pub fn active_player(&self) -> Option<&usize> {
223223
self.players_used.first()

server/src/content/incidents/earthquake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::content::custom_phase_actions::{
99
use crate::content::wonders::get_wonder;
1010
use crate::game::Game;
1111
use crate::incident::{Incident, IncidentBaseEffect, MoodModifier};
12-
use crate::player_events::{IncidentInfo, IncidentTarget};
12+
use crate::player_events::IncidentTarget;
1313
use crate::position::Position;
1414
use itertools::Itertools;
1515

server/src/content/incidents/famine.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::content::custom_phase_actions::UnitsRequest;
55
use crate::game::Game;
66
use crate::incident::{Incident, IncidentBaseEffect, MoodModifier, PermanentIncidentEffect};
77
use crate::player::Player;
8-
use crate::player_events::{IncidentInfo, IncidentTarget};
8+
use crate::player_events::IncidentTarget;
99
use crate::playing_actions::PlayingActionType;
1010
use crate::position::Position;
1111
use crate::resource_pile::ResourcePile;

server/src/content/incidents/trade.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,10 @@ fn reformation() -> Incident {
196196
))
197197
},
198198
|game, s| {
199-
let &p = game.current_event().active_player().expect("should have active player");
199+
let &p = game
200+
.current_event()
201+
.active_player()
202+
.expect("should have active player");
200203
let donor = game.get_player_mut(p);
201204
let pos = s.choice[0];
202205
donor

server/src/content/incidents/trojan.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use crate::ability_initializer::AbilityInitializerSetup;
2-
use crate::combat::{
3-
Combat, CombatModifier, CombatRetreatState,
4-
};
2+
use crate::combat::{Combat, CombatModifier, CombatRetreatState};
53
use crate::combat_listeners::CombatResult;
64
use crate::content::advances::get_advance;
75
use crate::content::builtin::Builtin;
@@ -68,9 +66,7 @@ pub(crate) fn decide_trojan_horse() -> Builtin {
6866
));
6967
game.permanent_incident_effects
7068
.retain(|e| !matches!(e, PermanentIncidentEffect::TrojanHorse));
71-
c
72-
.modifiers
73-
.push(CombatModifier::TrojanHorse);
69+
c.modifiers.push(CombatModifier::TrojanHorse);
7470
}
7571
},
7672
)

server/src/game.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ impl Game {
416416
self.current_events
417417
.push(CurrentEventState::new(players[0], current_event_type));
418418
}
419-
419+
420420
let event_index = self.current_events.len() - 1;
421421

422422
let mut value = details.clone();

server/src/incident.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ impl IncidentBuilder {
406406
move |game, s, _| {
407407
gain_reward(game, s);
408408
},
409-
)
409+
)
410410
}
411411

412412
pub(crate) fn add_decrease_mood(

server/src/status_phase.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ pub(crate) fn draw_cards() -> Builtin {
140140
.add_simple_current_event_listener(
141141
|event| &mut event.on_status_phase,
142142
0,
143-
|_game, p, name, s| {
143+
|_game, _p, _name, _s| {
144144
// todo every player draws 1 action card and 1 objective card
145145
},
146146
)

server/src/wonder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub(crate) fn on_draw_wonder_card() -> Builtin {
133133
None
134134
}
135135
},
136-
|game, s, _| {
136+
|game, s, ()| {
137137
if s.choice {
138138
let name = find_public_wonder(game)
139139
.expect("public wonder card not found")

0 commit comments

Comments
 (0)