Simplify/clarify watchdog code
- Use Debug trait object rather than arbitrary closure
- Combine bool+Instant into Option<Instant>
- Disambiguate "timeout"
- Add comments
- Simplify multi-argument matches
Test: keystore2_test
Test: libwatchdog_rs.test
Flag: None, refactor
Change-Id: Ieb16257c763fc2e04d592d97f341fea27aad726f
diff --git a/keystore2/src/security_level.rs b/keystore2/src/security_level.rs
index 00e0480..8ce802e 100644
--- a/keystore2/src/security_level.rs
+++ b/keystore2/src/security_level.rs
@@ -109,14 +109,12 @@
fn watch_millis(&self, id: &'static str, millis: u64) -> Option<wd::WatchPoint> {
let sec_level = self.security_level;
- wd::watch_millis_with(id, millis, move || format!("SecurityLevel {:?}", sec_level))
+ wd::watch_millis_with(id, millis, sec_level)
}
fn watch(&self, id: &'static str) -> Option<wd::WatchPoint> {
let sec_level = self.security_level;
- wd::watch_millis_with(id, wd::DEFAULT_TIMEOUT_MS, move || {
- format!("SecurityLevel {:?}", sec_level)
- })
+ wd::watch_millis_with(id, wd::DEFAULT_TIMEOUT_MS, sec_level)
}
fn store_new_key(