diff --git a/neqo-common/src/codec.rs b/neqo-common/src/codec.rs index f04b75c71f..7fc31641df 100644 --- a/neqo-common/src/codec.rs +++ b/neqo-common/src/codec.rs @@ -162,7 +162,6 @@ impl<'a> Decoder<'a> { // Implement `AsRef` for `Decoder` so that values can be examined without // moving the cursor. impl<'a> AsRef<[u8]> for Decoder<'a> { - #[must_use] fn as_ref(&self) -> &'a [u8] { &self.buf[self.offset..] } @@ -175,7 +174,6 @@ impl Debug for Decoder<'_> { } impl<'a> From<&'a [u8]> for Decoder<'a> { - #[must_use] fn from(buf: &'a [u8]) -> Self { Decoder::new(buf) } @@ -185,14 +183,12 @@ impl<'a, T> From<&'a T> for Decoder<'a> where T: AsRef<[u8]>, { - #[must_use] fn from(buf: &'a T) -> Self { Decoder::new(buf.as_ref()) } } impl<'b> PartialEq> for Decoder<'_> { - #[must_use] fn eq(&self, other: &Decoder<'b>) -> bool { self.buf == other.buf } @@ -452,14 +448,12 @@ impl AsMut<[u8]> for Encoder { } impl<'a> From> for Encoder { - #[must_use] fn from(dec: Decoder<'a>) -> Self { Self::from(&dec.buf[dec.offset..]) } } impl From<&[u8]> for Encoder { - #[must_use] fn from(buf: &[u8]) -> Self { Self { buf: Vec::from(buf), @@ -468,7 +462,6 @@ impl From<&[u8]> for Encoder { } impl From for Vec { - #[must_use] fn from(buf: Encoder) -> Self { buf.buf } diff --git a/neqo-common/src/datagram.rs b/neqo-common/src/datagram.rs index e671d70382..f2a33caf5d 100644 --- a/neqo-common/src/datagram.rs +++ b/neqo-common/src/datagram.rs @@ -75,7 +75,6 @@ impl + AsMut<[u8]>> DerefMut for Datagram { impl> Deref for Datagram { type Target = [u8]; - #[must_use] fn deref(&self) -> &Self::Target { AsRef::<[u8]>::as_ref(self) } diff --git a/neqo-common/src/header.rs b/neqo-common/src/header.rs index a480eb67ca..1d4afaaa23 100644 --- a/neqo-common/src/header.rs +++ b/neqo-common/src/header.rs @@ -36,11 +36,13 @@ impl Header { ) } + #[allow(clippy::missing_const_for_fn)] // TODO: False positive on nightly. Check periodically if this can be removed. #[must_use] pub fn name(&self) -> &str { &self.name } + #[allow(clippy::missing_const_for_fn)] // TODO: False positive on nightly. Check periodically if this can be removed. #[must_use] pub fn value(&self) -> &str { &self.value diff --git a/neqo-crypto/src/agent.rs b/neqo-crypto/src/agent.rs index 6e49111288..a870c30f25 100644 --- a/neqo-crypto/src/agent.rs +++ b/neqo-crypto/src/agent.rs @@ -631,6 +631,7 @@ impl SecretAgent { } /// Return any fatal alert that the TLS stack might have sent. + #[allow(clippy::missing_const_for_fn)] // TODO: False positive on nightly. Check periodically if this can be removed. #[must_use] pub fn alert(&self) -> Option<&Alert> { (*self.alert).as_ref() @@ -773,7 +774,7 @@ impl SecretAgent { unsafe { prio::PR_Close(self.fd.cast()); } - }; + } let _output = self.io.take_output(); self.fd = null_mut(); } @@ -797,6 +798,7 @@ impl SecretAgent { } /// Get the active ECH configuration, which is empty if ECH is disabled. + #[allow(clippy::missing_const_for_fn)] // TODO: False positive on nightly. Check periodically if this can be removed. #[must_use] pub fn ech_config(&self) -> &[u8] { &self.ech_config @@ -915,6 +917,7 @@ impl Client { ssl::SECSuccess } + #[allow(clippy::missing_const_for_fn)] // TODO: False positive on nightly. Check periodically if this can be removed. #[must_use] pub fn server_name(&self) -> &str { &self.server_name @@ -992,7 +995,6 @@ impl Client { impl Deref for Client { type Target = SecretAgent; - #[must_use] fn deref(&self) -> &SecretAgent { &self.agent } @@ -1201,7 +1203,6 @@ impl Server { impl Deref for Server { type Target = SecretAgent; - #[must_use] fn deref(&self) -> &SecretAgent { &self.agent } @@ -1228,7 +1229,6 @@ pub enum Agent { impl Deref for Agent { type Target = SecretAgent; - #[must_use] fn deref(&self) -> &SecretAgent { match self { Self::Client(c) => c, @@ -1247,14 +1247,12 @@ impl DerefMut for Agent { } impl From for Agent { - #[must_use] fn from(c: Client) -> Self { Self::Client(c) } } impl From for Agent { - #[must_use] fn from(s: Server) -> Self { Self::Server(s) } diff --git a/neqo-crypto/src/agentio.rs b/neqo-crypto/src/agentio.rs index 9fc098aa88..23bf7c9571 100644 --- a/neqo-crypto/src/agentio.rs +++ b/neqo-crypto/src/agentio.rs @@ -123,7 +123,6 @@ impl RecordList { impl Deref for RecordList { type Target = Vec; - #[must_use] fn deref(&self) -> &Vec { &self.records } @@ -141,7 +140,6 @@ impl Iterator for RecordListIter { impl IntoIterator for RecordList { type Item = Record; type IntoIter = RecordListIter; - #[must_use] fn into_iter(self) -> Self::IntoIter { RecordListIter(self.records.into_iter()) } diff --git a/neqo-crypto/src/auth.rs b/neqo-crypto/src/auth.rs index a697959897..a693ce2746 100644 --- a/neqo-crypto/src/auth.rs +++ b/neqo-crypto/src/auth.rs @@ -37,7 +37,6 @@ pub enum AuthenticationStatus { } impl From for PRErrorCode { - #[must_use] fn from(v: AuthenticationStatus) -> Self { v as Self } @@ -46,7 +45,6 @@ impl From for PRErrorCode { // Note that this mapping should be removed after gecko eventually learns how to // map into the enumerated type. impl From for AuthenticationStatus { - #[must_use] fn from(v: PRErrorCode) -> Self { Self::from_repr(v).unwrap_or(Self::Unknown) } diff --git a/neqo-crypto/src/err.rs b/neqo-crypto/src/err.rs index 71ffc51953..b4d6134c69 100644 --- a/neqo-crypto/src/err.rs +++ b/neqo-crypto/src/err.rs @@ -83,11 +83,9 @@ impl Error { } impl std::error::Error for Error { - #[must_use] fn cause(&self) -> Option<&dyn std::error::Error> { None } - #[must_use] fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { None } @@ -100,13 +98,11 @@ impl std::fmt::Display for Error { } impl From for Error { - #[must_use] fn from(_: std::num::TryFromIntError) -> Self { Self::IntegerOverflow } } impl From for Error { - #[must_use] fn from(_: std::ffi::NulError) -> Self { Self::InternalError } diff --git a/neqo-crypto/src/p11.rs b/neqo-crypto/src/p11.rs index 4dfee9da73..5f3c78de68 100644 --- a/neqo-crypto/src/p11.rs +++ b/neqo-crypto/src/p11.rs @@ -58,7 +58,6 @@ macro_rules! scoped_ptr { impl Deref for $scoped { type Target = *mut $target; - #[must_use] fn deref(&self) -> &*mut $target { &self.ptr } @@ -108,7 +107,6 @@ impl PublicKey { } impl Clone for PublicKey { - #[must_use] fn clone(&self) -> Self { let ptr = unsafe { SECKEY_CopyPublicKey(self.ptr) }; assert!(!ptr.is_null()); @@ -163,7 +161,6 @@ impl PrivateKey { unsafe impl Send for PrivateKey {} impl Clone for PrivateKey { - #[must_use] fn clone(&self) -> Self { let ptr = unsafe { SECKEY_CopyPrivateKey(self.ptr) }; assert!(!ptr.is_null()); @@ -211,7 +208,6 @@ impl SymKey { } impl Clone for SymKey { - #[must_use] fn clone(&self) -> Self { let ptr = unsafe { PK11_ReferenceSymKey(self.ptr) }; assert!(!ptr.is_null()); diff --git a/neqo-crypto/src/secrets.rs b/neqo-crypto/src/secrets.rs index bbc1fd70b5..9ab19d586d 100644 --- a/neqo-crypto/src/secrets.rs +++ b/neqo-crypto/src/secrets.rs @@ -35,7 +35,6 @@ pub enum SecretDirection { } impl From for SecretDirection { - #[must_use] fn from(dir: SSLSecretDirection::Type) -> Self { Self::from_repr(dir).expect("Invalid secret direction") } diff --git a/neqo-crypto/src/time.rs b/neqo-crypto/src/time.rs index d6269044a8..e819bea488 100644 --- a/neqo-crypto/src/time.rs +++ b/neqo-crypto/src/time.rs @@ -141,7 +141,6 @@ impl TryInto for Time { } impl From