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

chore: Enable the unused_result_ok lint #2333

Merged
merged 8 commits into from
Jan 10, 2025
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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ redundant_type_annotations = "warn"
ref_patterns = "warn"
renamed_function_params = "warn"
unneeded_field_pattern = "warn"
unused_result_ok = "warn"
unused_trait_names = "warn"

# Optimize build dependencies, because bindgen and proc macros / style
Expand Down
11 changes: 7 additions & 4 deletions neqo-http3/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,12 @@ impl Http3Connection {
conn.stream_stop_sending(stream_id, Error::HttpStreamCreation.code())?;
return Ok(ReceiveOutput::NoOutput);
}
// set incoming WebTransport streams to be fair (share bandwidth)
conn.stream_fairness(stream_id, true).ok();
// Set incoming WebTransport streams to be fair (share bandwidth).
// We may call this with an invalid stream ID, so ignore that error.
match conn.stream_fairness(stream_id, true) {
Ok(()) | Err(neqo_transport::Error::InvalidStreamId) => (),
Err(e) => return Err(Error::from(e)),
};
qinfo!(
[self],
"A new WebTransport stream {} for session {}.",
Expand Down Expand Up @@ -1283,8 +1287,7 @@ impl Http3Connection {
.stream_create(stream_type)
.map_err(|e| Error::map_stream_create_errors(&e))?;
// Set outgoing WebTransport streams to be fair (share bandwidth)
// This really can't fail, panics if it does
conn.stream_fairness(stream_id, true).unwrap();
conn.stream_fairness(stream_id, true)?;

self.webtransport_create_stream_internal(
wt,
Expand Down
4 changes: 0 additions & 4 deletions neqo-http3/src/connection_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -812,10 +812,6 @@ impl Http3Client {
/// # Errors
///
/// It may return `InvalidStreamId` if a stream does not exist anymore.
///
/// # Panics
///
/// This cannot panic.
pub fn webtransport_set_fairness(&mut self, stream_id: StreamId, fairness: bool) -> Res<()> {
Http3Connection::stream_set_fairness(&mut self.conn, stream_id, fairness)
}
Expand Down
2 changes: 1 addition & 1 deletion neqo-transport/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1559,7 +1559,7 @@ impl Connection {
);
path.borrow_mut().add_received(d.len());
let res = self.input_path(&path, d, received);
self.capture_error(Some(path), now, 0, res).ok();
_ = self.capture_error(Some(path), now, 0, res);
}

fn input_path(
Expand Down
4 changes: 2 additions & 2 deletions neqo-transport/src/connection/tests/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ fn sendorder_test(order_of_sendorder: &[Option<SendOrder>]) {
streams.push(id);
ordered.push((id, *sendorder));
// must be set before sendorder
client.streams.set_fairness(id, true).ok();
client.streams.set_sendorder(id, *sendorder).ok();
client.streams.set_fairness(id, true).unwrap();
client.streams.set_sendorder(id, *sendorder).unwrap();
}
// Write some data to all the streams
for stream_id in streams {
Expand Down
4 changes: 2 additions & 2 deletions neqo-transport/tests/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ fn handshake_mlkem768x25519() {

client
.set_groups(&[neqo_crypto::TLS_GRP_KEM_MLKEM768X25519])
.ok();
client.send_additional_key_shares(0).ok();
.unwrap();
client.send_additional_key_shares(0).unwrap();

test_fixture::handshake(&mut client, &mut server);
assert_eq!(*client.state(), State::Confirmed);
Expand Down
Loading