meta: cargo clippy & fmt

pull/151/head
Jake McGinty 2021-09-14 12:24:04 +09:00
parent b395f7f736
commit d4822afc98
2 changed files with 10 additions and 3 deletions

View File

@ -615,7 +615,11 @@ fn get_session(
.ok_or(ServerError::Unauthorized)?;
let pubkey = pubkey.to_str().map_err(|_| ServerError::Unauthorized)?;
let pubkey = Key::from_base64(pubkey).map_err(|_| ServerError::Unauthorized)?;
if pubkey.as_bytes().ct_eq(&context.public_key.as_bytes()).into() {
if pubkey
.as_bytes()
.ct_eq(context.public_key.as_bytes())
.into()
{
let peer = DatabasePeer::get_from_ip(&context.db.lock(), addr).map_err(|e| match e {
rusqlite::Error::QueryReturnedNoRows => ServerError::Unauthorized,
e => ServerError::Database(e),

View File

@ -328,7 +328,10 @@ pub fn apply(builder: &DeviceUpdate, iface: &InterfaceName) -> io::Result<()> {
}
for peer in &builder.peers {
request.push_str(&format!("public_key={}\n", hex::encode(peer.public_key.as_bytes())));
request.push_str(&format!(
"public_key={}\n",
hex::encode(peer.public_key.as_bytes())
));
if peer.replace_allowed_ips {
request.push_str("replace_allowed_ips=true\n");