Skip to content

Commit 10e1b8a

Browse files
committed
Make clippy happy
1 parent 8148b82 commit 10e1b8a

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

src/keylog.rs

+6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ impl KeyLogFile {
6060
}
6161
}
6262

63+
impl Default for KeyLogFile {
64+
fn default() -> Self {
65+
Self::new()
66+
}
67+
}
68+
6369
impl KeyLog for KeyLogFile {
6470
fn log(&self, label: &str, client_random: &[u8], secret: &[u8]) {
6571
match self

src/session.rs

+15-16
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ pub struct NoiseConfig {
8585
impl ClientConfig for NoiseConfig {
8686
fn start_session(
8787
self: Arc<Self>,
88-
version: u32,
89-
server_name: &str,
88+
_version: u32,
89+
_server_name: &str,
9090
params: &TransportParameters,
9191
) -> Result<Box<dyn Session>, ConnectError> {
9292
Ok(Box::new(NoiseConfig::start_session(
@@ -100,17 +100,17 @@ impl ClientConfig for NoiseConfig {
100100
impl ServerConfig for NoiseConfig {
101101
fn start_session(
102102
self: Arc<Self>,
103-
version: u32,
103+
_version: u32,
104104
params: &TransportParameters,
105105
) -> Box<dyn Session> {
106106
Box::new(NoiseConfig::start_session(&self, Side::Server, params))
107107
}
108108

109109
fn initial_keys(
110110
&self,
111-
version: u32,
112-
dst_cid: &ConnectionId,
113-
side: Side,
111+
_version: u32,
112+
_dst_cid: &ConnectionId,
113+
_side: Side,
114114
) -> Result<Keys, quinn_proto::crypto::UnsupportedVersion> {
115115
Ok(Keys {
116116
header: header_keypair(),
@@ -121,7 +121,7 @@ impl ServerConfig for NoiseConfig {
121121
})
122122
}
123123

124-
fn retry_tag(&self, version: u32, orig_dst_cid: &ConnectionId, packet: &[u8]) -> [u8; 16] {
124+
fn retry_tag(&self, _version: u32, orig_dst_cid: &ConnectionId, packet: &[u8]) -> [u8; 16] {
125125
let mut pseudo_packet = Vec::with_capacity(packet.len() + orig_dst_cid.len() + 1);
126126
pseudo_packet.push(orig_dst_cid.len() as u8);
127127
pseudo_packet.extend_from_slice(orig_dst_cid);
@@ -318,7 +318,7 @@ impl Session for NoiseSession {
318318
}
319319
let (remote_s, rest) = rest.split_at(32);
320320
let mut s = [0; 32];
321-
self.xoodyak.decrypt(&remote_s, &mut s);
321+
self.xoodyak.decrypt(remote_s, &mut s);
322322
let s = PublicKey::from_bytes(&s)
323323
.map_err(|_| connection_refused("invalid static public key"))?;
324324
self.remote_s = Some(s);
@@ -343,9 +343,8 @@ impl Session for NoiseSession {
343343
.supported_protocols
344344
.as_ref()
345345
.expect("invalid config")
346-
.into_iter()
347-
.find(|proto| proto.as_slice() == alpn)
348-
.is_some();
346+
.iter()
347+
.any(|proto| proto.as_slice() == alpn);
349348
if !is_supported {
350349
return Err(connection_refused("unsupported alpn"));
351350
}
@@ -356,11 +355,11 @@ impl Session for NoiseSession {
356355
}
357356
let (params, auth) = rest.split_at(rest.len() - 16);
358357
let mut transport_parameters = vec![0; params.len()];
359-
self.xoodyak.decrypt(&params, &mut transport_parameters);
358+
self.xoodyak.decrypt(params, &mut transport_parameters);
360359
// check tag
361360
let mut tag = [0; 16];
362361
self.xoodyak.squeeze(&mut tag);
363-
if !bool::from(tag.ct_eq(&auth)) {
362+
if !bool::from(tag.ct_eq(auth)) {
364363
return Err(connection_refused("invalid authentication tag"));
365364
}
366365
self.remote_transport_parameters = Some(TransportParameters::read(
@@ -377,7 +376,7 @@ impl Session for NoiseSession {
377376
}
378377
let (remote_e, rest) = handshake.split_at(32);
379378
let mut e = [0; 32];
380-
self.xoodyak.decrypt(&remote_e, &mut e);
379+
self.xoodyak.decrypt(remote_e, &mut e);
381380
let e = PublicKey::from_bytes(&e)
382381
.map_err(|_| connection_refused("invalid ephemeral public key"))?;
383382
self.remote_e = Some(e);
@@ -393,11 +392,11 @@ impl Session for NoiseSession {
393392
}
394393
let (params, auth) = rest.split_at(rest.len() - 16);
395394
let mut transport_parameters = vec![0; params.len()];
396-
self.xoodyak.decrypt(&params, &mut transport_parameters);
395+
self.xoodyak.decrypt(params, &mut transport_parameters);
397396
// check tag
398397
let mut tag = [0; 16];
399398
self.xoodyak.squeeze(&mut tag);
400-
if !bool::from(tag.ct_eq(&auth)) {
399+
if !bool::from(tag.ct_eq(auth)) {
401400
return Err(connection_refused("invalid authentication tag"));
402401
}
403402
self.remote_transport_parameters = Some(TransportParameters::read(

0 commit comments

Comments
 (0)