summaryrefslogtreecommitdiff
path: root/tests/util
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-01-28 14:24:12 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-02-02 10:25:02 +0000
commit0972bbe82623c3d9649b6023d8f50d304aa0cde6 (patch)
tree5f9c2a3cd1981ae2b04cd07ba466f2a8d8f74f0c /tests/util
parentf49e61589e32217f97c94aa86d826f6b65170fba (diff)
downloadnitrokey-rs-0972bbe82623c3d9649b6023d8f50d304aa0cde6.tar.gz
nitrokey-rs-0972bbe82623c3d9649b6023d8f50d304aa0cde6.tar.bz2
Refactor User and Admin to use a mutable reference
In the initial nitrokey-rs implementation, the Admin and the User struct take the Device by value to make sure that the user cannot initiate a second authentication while this first is still active (which would invalidate the temporary password). Now we realized that this is not necessary – taking a mutable reference has the same effect, but leads to a much cleaner API. This patch refactors the Admin and User structs – and all dependent code – to use a mutable reference instead of a Device value.
Diffstat (limited to 'tests/util')
-rw-r--r--tests/util/mod.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/util/mod.rs b/tests/util/mod.rs
index bd207a9..f80372d 100644
--- a/tests/util/mod.rs
+++ b/tests/util/mod.rs
@@ -8,7 +8,7 @@ pub static USER_PASSWORD: &str = "123456";
#[macro_export]
macro_rules! unwrap_ok {
- ($val:expr) => {{
+ ($val:expr) => {
match $val {
Ok(val) => val,
Err(err) => panic!(
@@ -18,12 +18,12 @@ macro_rules! unwrap_ok {
err
),
}
- }};
+ };
}
#[macro_export]
macro_rules! assert_any_ok {
- ($val:expr) => {{
+ ($val:expr) => {
match &$val {
Ok(_) => {}
Err(err) => panic!(
@@ -33,12 +33,12 @@ macro_rules! assert_any_ok {
err
),
}
- }};
+ };
}
#[macro_export]
macro_rules! assert_ok {
- ($left:expr, $right:expr) => {{
+ ($left:expr, $right:expr) => {
match &$right {
Ok(right) => match &$left {
left => {
@@ -59,7 +59,7 @@ macro_rules! assert_ok {
$left, right_err
),
}
- }};
+ };
}
#[macro_export]