Skip to content

Commit 8ac1537

Browse files
committed
chore: implement Default for players
for linting
1 parent b8a05b6 commit 8ac1537

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

topics/tic-tac-toe/src/player/ai_minmax.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ pub struct AIMinMax {
99
ai_player: Option<PlayerID>, // (me)
1010
}
1111

12+
impl Default for AIMinMax {
13+
fn default() -> Self {
14+
Self::new()
15+
}
16+
}
17+
1218
impl AIMinMax {
1319
pub fn new() -> Self {
1420
AIMinMax { ai_player: None }

topics/tic-tac-toe/src/player/terminal.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ pub struct TerminalPlayer {
1616
me: Option<PlayerID>,
1717
}
1818

19+
impl Default for TerminalPlayer {
20+
fn default() -> Self {
21+
Self::new()
22+
}
23+
}
24+
1925
impl TerminalPlayer {
2026
pub fn new() -> Self {
2127
TerminalPlayer {
@@ -34,7 +40,7 @@ impl TerminalPlayer {
3440
.map_err(|e| Error::Other(e.to_string()))?;
3541

3642
match input.trim().parse::<u8>() {
37-
Ok(num) if num < 9 => return Ok(num),
43+
Ok(num) if num < 9 => Ok(num),
3844
_ => Err(Error::InvalidInput),
3945
}
4046
}

0 commit comments

Comments
 (0)