Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy warnings #145

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/asynch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ where
self.split_with(ManagedSplitState::new())
}

#[allow(clippy::type_complexity)] // Requires inherent type aliases to solve well.
pub fn split_with<StateContainer>(
self,
state: StateContainer,
Expand Down
6 changes: 2 additions & 4 deletions src/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ where
///
/// Returns an error if the handshake does not proceed. If an error occurs, the connection
/// instance must be recreated.
pub fn open<'v, Provider>(
&mut self,
mut context: TlsContext<'v, Provider>,
) -> Result<(), TlsError>
pub fn open<Provider>(&mut self, mut context: TlsContext<Provider>) -> Result<(), TlsError>
where
Provider: CryptoProvider<CipherSuite = CipherSuite>,
{
Expand Down Expand Up @@ -244,6 +241,7 @@ where
self.split_with(ManagedSplitState::new())
}

#[allow(clippy::type_complexity)] // Requires inherent type aliases to solve well.
pub fn split_with<StateContainer>(
self,
state: StateContainer,
Expand Down
6 changes: 3 additions & 3 deletions src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ where
certificate_request: Option<CertificateRequest>,
}

impl<'v, CipherSuite> Handshake<CipherSuite>
impl<CipherSuite> Handshake<CipherSuite>
where
CipherSuite: TlsCipherSuite,
{
Expand Down Expand Up @@ -437,10 +437,10 @@ where
}
}

fn process_server_verify<'a, 'v, Provider>(
fn process_server_verify<Provider>(
handshake: &mut Handshake<Provider::CipherSuite>,
key_schedule: &mut KeySchedule<Provider::CipherSuite>,
config: &TlsConfig<'a>,
config: &TlsConfig<'_>,
crypto_provider: &mut Provider,
record: ServerRecord<'_, Provider::CipherSuite>,
) -> Result<State, TlsError>
Expand Down
6 changes: 3 additions & 3 deletions src/handshake/certificate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ impl<'a> CertificateEntryRef<'a> {
}

pub(crate) fn encode(&self, buf: &mut CryptoBuffer<'_>) -> Result<(), TlsError> {
match self {
&CertificateEntryRef::RawPublicKey(_key) => {
match *self {
CertificateEntryRef::RawPublicKey(_key) => {
todo!("ASN1_subjectPublicKeyInfo encoding?");
// buf.with_u24_length(|buf| buf.extend_from_slice(key))?;
}
&CertificateEntryRef::X509(cert) => {
CertificateEntryRef::X509(cert) => {
buf.with_u24_length(|buf| buf.extend_from_slice(cert))?;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/record_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ impl<'a> RecordReader<'a> {
self.consume(header, key_schedule.transcript_hash())
}

fn advance_blocking<'m>(
&'m mut self,
fn advance_blocking(
&mut self,
transport: &mut impl BlockingRead,
amount: usize,
) -> Result<(), TlsError> {
Expand Down
2 changes: 1 addition & 1 deletion tests/psk_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn setup() -> (SocketAddr, JoinHandle<()>) {
let mut conn = acceptor.accept(stream).unwrap();
let mut buf = [0; 64];
let len = conn.read(&mut buf[..]).unwrap();
conn.write(&buf[..len]).unwrap();
conn.write_all(&buf[..len]).unwrap();
});
(addr, h)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/tlsserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl Connection {
// If we have a successful but empty read, that's an EOF.
// Otherwise, we shove the data into the TLS session.
match maybe_len {
Some(len) if len == 0 => {
Some(0) => {
log::debug!("back eof");
self.closing = true;
}
Expand Down
Loading