1
Fork 0
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:
Steffo 2022-08-22 18:15:08 +02:00
parent f3cc8a0910
commit e6e9368082
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -38,11 +38,7 @@ impl CardCode {
pub fn is_valid(&self) -> bool {
let is_ascii = self.full.is_ascii();
let is_long = match self.full.len() {
7 => true,
9 => true,
_ => false,
};
let is_long = matches!(self.full.len(), 7 | 9);
is_ascii && is_long
}