mirror of
https://github.com/Steffo99/patched-porobot.git
synced 2024-12-22 17:44:22 +00:00
Use matches!
macro to determine if CardCode::is_valid
This commit is contained in:
parent
f3cc8a0910
commit
e6e9368082
1 changed files with 1 additions and 5 deletions
|
@ -38,11 +38,7 @@ impl CardCode {
|
||||||
pub fn is_valid(&self) -> bool {
|
pub fn is_valid(&self) -> bool {
|
||||||
let is_ascii = self.full.is_ascii();
|
let is_ascii = self.full.is_ascii();
|
||||||
|
|
||||||
let is_long = match self.full.len() {
|
let is_long = matches!(self.full.len(), 7 | 9);
|
||||||
7 => true,
|
|
||||||
9 => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
|
|
||||||
is_ascii && is_long
|
is_ascii && is_long
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue