Skip to content

Commit feaabd9

Browse files
committed
clippy
1 parent 412fb5a commit feaabd9

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

client/src/client.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ use crate::player_ui::{show_global_controls, show_globals, show_resources, show_
2424
use crate::{combat_ui, influence_ui, move_ui, recruit_unit_ui, status_phase_ui};
2525

2626
pub async fn init(features: &Features) -> State {
27-
let state = State::new(features).await;
28-
29-
state
27+
State::new(features).await
3028
}
3129

3230
pub fn render_and_update(

client/src/client_state.rs

+9
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ pub struct StateUpdates {
118118
updates: Vec<StateUpdate>,
119119
}
120120

121+
impl Default for StateUpdates {
122+
fn default() -> Self {
123+
Self::new()
124+
}
125+
}
126+
121127
impl StateUpdates {
122128
pub fn new() -> StateUpdates {
123129
StateUpdates { updates: vec![] }
@@ -167,13 +173,15 @@ impl State {
167173
self.pending_update = None;
168174
}
169175

176+
#[must_use]
170177
pub fn is_collect(&self) -> bool {
171178
if let ActiveDialog::CollectResources(_c) = &self.active_dialog {
172179
return true;
173180
}
174181
false
175182
}
176183

184+
#[must_use]
177185
pub fn has_dialog(&self) -> bool {
178186
!matches!(self.active_dialog, ActiveDialog::None)
179187
}
@@ -301,6 +309,7 @@ impl State {
301309
}
302310
}
303311

312+
#[must_use]
304313
pub fn can_play_action(game: &Game) -> bool {
305314
game.state == GameState::Playing && game.actions_left > 0
306315
}

client/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
clippy::cast_precision_loss,
55
clippy::cast_sign_loss,
66
clippy::cast_possible_wrap,
7-
clippy::cast_possible_truncation
7+
clippy::cast_possible_truncation,
8+
clippy::missing_panics_doc
89
)]
910

1011
mod advance_ui;

client/src/remote_client/bin/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl RemoteClient {
9595
if s.is_object() {
9696
log("received state");
9797
let game1 = Game::from_data(
98-
serde_wasm_bindgen::from_value(s.into()).expect("game should be of type game data"),
98+
serde_wasm_bindgen::from_value(s).expect("game should be of type game data"),
9999
);
100100
self.game = Some(game1);
101101
self.state = RemoteClientState::Playing;

0 commit comments

Comments
 (0)