1
0
Fork 0

Use matches macro

Dieser Commit ist enthalten in:
Jake Howard 2021-03-27 14:03:07 +00:00
Ursprung 16eb0a56f9
Commit ea57dc3bc9
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 57AFB45680EDD477
2 geänderte Dateien mit 7 neuen und 22 gelöschten Zeilen

Datei anzeigen

@ -90,17 +90,11 @@ impl PartialOrd<i32> for UserOrgType {
} }
fn gt(&self, other: &i32) -> bool { fn gt(&self, other: &i32) -> bool {
match self.partial_cmp(other) { !matches!(self.partial_cmp(other), Some(Ordering::Less) | Some(Ordering::Equal))
Some(Ordering::Less) | Some(Ordering::Equal) => false,
_ => true,
}
} }
fn ge(&self, other: &i32) -> bool { fn ge(&self, other: &i32) -> bool {
match self.partial_cmp(other) { !matches!(self.partial_cmp(other), Some(Ordering::Less))
Some(Ordering::Less) => false,
_ => true,
}
} }
} }
@ -119,17 +113,11 @@ impl PartialOrd<UserOrgType> for i32 {
} }
fn lt(&self, other: &UserOrgType) -> bool { fn lt(&self, other: &UserOrgType) -> bool {
match self.partial_cmp(other) { matches!(self.partial_cmp(other), Some(Ordering::Less) | None)
Some(Ordering::Less) | None => true,
_ => false,
}
} }
fn le(&self, other: &UserOrgType) -> bool { fn le(&self, other: &UserOrgType) -> bool {
match self.partial_cmp(other) { matches!(self.partial_cmp(other), Some(Ordering::Less) | Some(Ordering::Equal) | None)
Some(Ordering::Less) | Some(Ordering::Equal) | None => true,
_ => false,
}
} }
} }

Datei anzeigen

@ -48,10 +48,7 @@ fn main() {
let level = LF::from_str(&CONFIG.log_level()).expect("Valid log level"); let level = LF::from_str(&CONFIG.log_level()).expect("Valid log level");
init_logging(level).ok(); init_logging(level).ok();
let extra_debug = match level { let extra_debug = matches!(level, LF::Trace | LF::Debug);
LF::Trace | LF::Debug => true,
_ => false,
};
check_data_folder(); check_data_folder();
check_rsa_keys(); check_rsa_keys();
@ -64,10 +61,10 @@ fn main() {
const HELP: &str = "\ const HELP: &str = "\
A Bitwarden API server written in Rust A Bitwarden API server written in Rust
USAGE: USAGE:
bitwarden_rs bitwarden_rs
FLAGS: FLAGS:
-h, --help Prints help information -h, --help Prints help information
-v, --version Prints the app version -v, --version Prints the app version