Cleaning up clippy warning
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
6a22429632
commit
7515462433
5 changed files with 9 additions and 7 deletions
|
@ -5,7 +5,7 @@ use env_logger;
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
|
||||||
use std:: {
|
use std:: {
|
||||||
net::{SocketAddr, TcpStream},
|
net::TcpStream,
|
||||||
error::Error,
|
error::Error,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
io::{Write, Read},
|
io::{Write, Read},
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub struct Keyring {
|
||||||
impl Keyring {
|
impl Keyring {
|
||||||
pub fn new(certificate: Certificate) -> Keyring {
|
pub fn new(certificate: Certificate) -> Keyring {
|
||||||
Keyring {
|
Keyring {
|
||||||
certificate: certificate,
|
certificate,
|
||||||
known_keys: HashMap::new()
|
known_keys: HashMap::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ pub fn generate_key(out: PathBuf) {
|
||||||
let cert = certificate.to_cbor().unwrap();
|
let cert = certificate.to_cbor().unwrap();
|
||||||
|
|
||||||
let mut writer = File::create(&out)
|
let mut writer = File::create(&out)
|
||||||
.expect(&format!{"Could not create out file {}", &out.display()});
|
.unwrap_or_else(|_| panic!{"Could not create out file {}", &out.display()});
|
||||||
|
|
||||||
writer.write_all(&cert).unwrap();
|
writer.write_all(&cert).unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ use std::sync::RwLock;
|
||||||
use std::sync::RwLockReadGuard;
|
use std::sync::RwLockReadGuard;
|
||||||
use std::sync::RwLockWriteGuard;
|
use std::sync::RwLockWriteGuard;
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::hash_map::{HashMap, Entry};
|
||||||
|
|
||||||
use coffer_common::coffer::*;
|
use coffer_common::coffer::*;
|
||||||
|
|
||||||
|
@ -34,8 +34,10 @@ impl Coffer for CofferMap {
|
||||||
|
|
||||||
match lock.get_mut(&key.shard) {
|
match lock.get_mut(&key.shard) {
|
||||||
Some(shard) => {
|
Some(shard) => {
|
||||||
if shard.contains_key(&key.key) { Err(CofferError::Msg("Key exists")) }
|
match shard.entry(key.key) {
|
||||||
else { shard.insert(key.key, value); Ok(()) }
|
Entry::Occupied(_) => Err(CofferError::Msg("Key exists")),
|
||||||
|
Entry::Vacant(v) => { v.insert(value); Ok(()) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
lock.insert(key.shard.clone(), HashMap::new());
|
lock.insert(key.shard.clone(), HashMap::new());
|
||||||
|
|
|
@ -59,7 +59,7 @@ where C: Coffer + Send + Sync + 'static
|
||||||
|
|
||||||
debug!{"Binding to socket {:?}", socket}
|
debug!{"Binding to socket {:?}", socket}
|
||||||
let mut listener = TcpListener::bind(socket).await
|
let mut listener = TcpListener::bind(socket).await
|
||||||
.expect(format!{"Could not bind to socket {}", socket}.as_str());
|
.expect("Could not bind to socket");
|
||||||
|
|
||||||
let server = async move {
|
let server = async move {
|
||||||
let mut incoming = listener.incoming();
|
let mut incoming = listener.incoming();
|
||||||
|
|
Loading…
Reference in a new issue