Skip to content

Commit 91325b4

Browse files
Slient some clippy warnings
1 parent 089ce91 commit 91325b4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/quic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use cipher::BlockCipherEncrypt;
2424
use cipher::StreamCipherSeek;
2525

2626
trait HasHeaderKey {
27+
#[allow(clippy::new_ret_no_self)]
2728
fn new(key: AeadKey) -> Result<HeaderProtectionKey, Error>;
2829
}
2930

@@ -57,6 +58,7 @@ impl HasHeaderKey for ChaCha20Poly1305 {
5758
}
5859

5960
#[enum_dispatch(MaskSample)]
61+
#[allow(clippy::large_enum_variant)]
6062
pub enum HeaderProtectionKey {
6163
#[cfg(feature = "aes")]
6264
Aes128Ecb(aes::Aes128),

src/ticketer.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ fn try_split_at(data: &[u8], at: usize) -> Option<(&[u8], &[u8])> {
3131
pub struct Ticketer {}
3232

3333
impl Ticketer {
34+
#[allow(clippy::new_ret_no_self)]
3435
pub fn new() -> Result<Arc<dyn ProducesTickets>, Error> {
3536
Ok(Arc::new(TicketRotator::new(
36-
time::Duration::from_secs(6 * 60 * 60).as_secs() as u32,
37+
#[allow(clippy::cast_possible_truncation)] { time::Duration::from_secs(6 * 60 * 60).as_secs() as u32 },
3738
|| Ok(Box::new(AeadTicketProducer::new()?)),
3839
)?))
3940
}
@@ -83,7 +84,7 @@ impl ProducesTickets for AeadTicketProducer {
8384
// Random nonce, because a counter is a privacy leak.
8485
let mut nonce_buf = [0u8; 12];
8586
OsRng.try_fill_bytes(&mut nonce_buf).ok()?;
86-
let nonce = nonce_buf.try_into().ok()?;
87+
let nonce = nonce_buf.into();
8788

8889
// ciphertext structure is:
8990
// key_name: [u8; 16]

0 commit comments

Comments
 (0)