diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-14 23:00:15 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-15 12:45:54 -0500 |
commit | acd1173848b4db1c733af7d3f53d24aab900b542 (patch) | |
tree | b0a1151e390c6063169325bc4520d7b79ac50d9e /src/bin/rbw-agent/agent.rs | |
parent | cc20037ff21a259419c7c00f6fce82ded3888d1e (diff) | |
download | rbw-acd1173848b4db1c733af7d3f53d24aab900b542.tar.gz rbw-acd1173848b4db1c733af7d3f53d24aab900b542.zip |
clippy
Diffstat (limited to 'src/bin/rbw-agent/agent.rs')
-rw-r--r-- | src/bin/rbw-agent/agent.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/bin/rbw-agent/agent.rs b/src/bin/rbw-agent/agent.rs index fae8c7b..d64bf21 100644 --- a/src/bin/rbw-agent/agent.rs +++ b/src/bin/rbw-agent/agent.rs @@ -32,7 +32,7 @@ impl State { pub fn clear(&mut self) { self.priv_key = None; - self.org_keys = Default::default(); + self.org_keys = None; // no real better option to unwrap here self.timeout_chan.send(TimeoutEvent::Clear).unwrap(); } @@ -57,7 +57,7 @@ impl Agent { timeout_chan: r, state: std::sync::Arc::new(tokio::sync::RwLock::new(State { priv_key: None, - org_keys: Default::default(), + org_keys: None, timeout_chan: w, })), }) @@ -81,11 +81,7 @@ impl Agent { tokio::time::Duration::from_secs(60 * 60 * 24 * 365 * 2), )); loop { - let timeout = if let Some(timeout) = &mut self.timeout { - timeout - } else { - &mut forever - }; + let timeout = self.timeout.as_mut().unwrap_or(&mut forever); tokio::select! { sock = listener.accept() => { let mut sock = crate::sock::Sock::new( |