Arunscape / ECE421-GroupProject1

1 stars 1 forks source link

These if statements are identical. Is that intentional? #5

Open Arunscape opened 4 years ago

Arunscape commented 4 years ago

https://github.com/Arunscape/ECE421-GroupProject1/blob/425d74cfeb5c660a5d6b869197d5494f2fcb0615/connect4/connect4-lib/src/game/mod.rs#L94

  --> connect4-lib/src/game/mod.rs:94:77
   |
94 |                   } else if self.turn == self.board.width * self.board.height {
   |  _____________________________________________________________________________^
95 | |                     BoardState::Draw
96 | |                 } else {
   | |_________________^
   |
   = note: `#[deny(clippy::if_same_then_else)]` on by default
note: same as this
  --> connect4-lib/src/game/mod.rs:92:26
   |
92 |                   if draws {
   |  __________________________^
93 | |                     BoardState::Draw
94 | |                 } else if self.turn == self.board.width * self.board.height {
   | |_________________^
jacobrec commented 4 years ago

Yes, its a draw if both players win on the same move, or if there is no available move. Feel free to change to an or statement @Arunscape