Skip to content

Commit

Permalink
Use option chaining instead of match
Browse files Browse the repository at this point in the history
  • Loading branch information
shanemadden committed Jan 9, 2024
1 parent faf9bd9 commit 5f52f00
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/objects/impls/power_creep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,10 @@ impl TryFrom<AccountPowerCreep> for PowerCreep {
type Error = PowerCreepNotSpawned;

fn try_from(account_power_creep: AccountPowerCreep) -> Result<Self, Self::Error> {
match account_power_creep.id_internal() {
Some(_) => Ok(account_power_creep.unchecked_into()),
None => Err(PowerCreepNotSpawned {}),
}
account_power_creep
.id_internal()
.map(JsCast::unchecked_into)
.ok_or(PowerCreepNotSpawned {})
}
}

Expand Down

0 comments on commit 5f52f00

Please sign in to comment.