Skip to content

Commit

Permalink
refactor: Replaced match with ?
Browse files Browse the repository at this point in the history
  • Loading branch information
khoover committed Oct 13, 2024
1 parent 2324310 commit 2e69bd9
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/local/room_xy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,8 @@ impl RoomXY {
/// assert_eq!(forty_nine.checked_add((1, 1)), None);
/// ```
pub fn checked_add(self, rhs: (i8, i8)) -> Option<RoomXY> {
let x = match self.x.checked_add(rhs.0) {
Some(x) => x,
None => return None,
};
let y = match self.y.checked_add(rhs.1) {
Some(y) => y,
None => return None,
};
let x = self.x.checked_add(rhs.0)?;
let y = self.y.checked_add(rhs.1)?;
Some(RoomXY { x, y })
}

Expand Down

0 comments on commit 2e69bd9

Please sign in to comment.