diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2019-01-27 14:04:24 +0000 |
---|---|---|
committer | Robin Krahl <robin.krahl@ireas.org> | 2019-01-27 14:04:24 +0000 |
commit | 41a2303ad06f409cb932cf570ff6cc04dd6692fe (patch) | |
tree | ee3b3816908065db33cca2ef8dd6b68aa12efddf /src | |
parent | 3cab3525e9c0bd743aa419d286de38d346776fbd (diff) | |
download | nitrokey-rs-41a2303ad06f409cb932cf570ff6cc04dd6692fe.tar.gz nitrokey-rs-41a2303ad06f409cb932cf570ff6cc04dd6692fe.tar.bz2 |
Use if instead of match for boolean expression
Diffstat (limited to 'src')
-rw-r--r-- | src/device.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/device.rs b/src/device.rs index c4af8a8..386ce94 100644 --- a/src/device.rs +++ b/src/device.rs @@ -798,9 +798,10 @@ impl Pro { /// [`NotConnected`]: enum.CommunicationError.html#variant.NotConnected pub fn connect() -> Result<Pro, Error> { // TODO: maybe Option instead of Result? - match connect_enum(Model::Pro) { - true => Ok(Pro::new()), - false => Err(CommunicationError::NotConnected.into()), + if connect_enum(Model::Pro) { + Ok(Pro::new()) + } else { + Err(CommunicationError::NotConnected.into()) } } @@ -850,9 +851,10 @@ impl Storage { /// [`NotConnected`]: enum.CommunicationError.html#variant.NotConnected pub fn connect() -> Result<Storage, Error> { // TODO: maybe Option instead of Result? - match connect_enum(Model::Storage) { - true => Ok(Storage::new()), - false => Err(CommunicationError::NotConnected.into()), + if connect_enum(Model::Storage) { + Ok(Storage::new()) + } else { + Err(CommunicationError::NotConnected.into()) } } |