diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-11-09 10:16:43 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-11-09 10:16:43 +0200 |
commit | 38cbf4ab4cbc78bceaeedbd331e819dc6f49571c (patch) | |
tree | 1cf22f4b1acf93d5484ac16b32dac68f3bd89030 | |
parent | 119a4a0dc5f73962dd82e2e4aef03ca24f191e45 (diff) | |
download | sshca-38cbf4ab4cbc78bceaeedbd331e819dc6f49571c.tar.gz |
chore: fix things clippy complains about
Sponsored-by: author
-rw-r--r-- | src/cert.rs | 6 | ||||
-rw-r--r-- | src/store.rs | 14 |
2 files changed, 5 insertions, 15 deletions
diff --git a/src/cert.rs b/src/cert.rs index de04402..f10516c 100644 --- a/src/cert.rs +++ b/src/cert.rs @@ -117,12 +117,12 @@ pub trait CertificateAuthority { .arg("-s") .arg(&ca_key) .args(Self::OPTS) - .args(&["-n", &principals_list]) - .args(&[ + .args(["-n", &principals_list]) + .args([ "-I", &format!("certificate for {} {}", Self::KIND, principals_list), ]) - .args(&["-V", valid_for]) + .args(["-V", valid_for]) .arg(&sub_key_pub) .output() .map_err(|e| CAError::KeyError(KeyError::Run(e)))?; diff --git a/src/store.rs b/src/store.rs index e2c5349..f3ed0d7 100644 --- a/src/store.rs +++ b/src/store.rs @@ -134,12 +134,7 @@ impl KeyStore { /// Get host from store by name. pub fn get_host(&self, name: &str) -> Option<&Host> { - for host in self.hosts.iter() { - if host.name() == name { - return Some(host); - } - } - None + self.hosts.iter().find(|&host| host.name() == name) } /// Get a mutable reference to a host in store, by name. @@ -206,12 +201,7 @@ impl KeyStore { /// Find user in store by name. pub fn get_user(&self, name: &str) -> Option<&User> { - for u in self.users.iter() { - if u.name() == name { - return Some(u); - } - } - None + self.users.iter().find(|user| user.name() == name) } /// Get a mutable reference to a user in store, by name. |