Skip to content

Commit

Permalink
refactor: clippy match-same-arms & unnested-or-patterns (mozilla#…
Browse files Browse the repository at this point in the history
…1558)

* refactor: address clippy::match-same-arms

Addresses clippy lint match-same-arms.

https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

* refactor: address clippy::unnested-or-patterns

* Use v1 instead.

---------

Co-authored-by: Martin Thomson <[email protected]>
  • Loading branch information
mxinden and martinthomson authored Jan 17, 2024
1 parent 70e3ac4 commit 895f15d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion neqo-client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ impl QuicParameters {
params.versions(first.0, all.iter().map(|&x| x.0).collect())
} else {
let version = match alpn {
"h3" | "hq-interop" => Version::default(),
"h3" | "hq-interop" => Version::Version1,
"h3-29" | "hq-29" => Version::Draft29,
"h3-30" | "hq-30" => Version::Draft30,
"h3-31" | "hq-31" => Version::Draft31,
Expand Down
6 changes: 2 additions & 4 deletions neqo-interop/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,11 +736,9 @@ fn run_test<'t>(peer: &Peer, test: &'t Test) -> (&'t Test, String) {
return (test, String::from("OK"));
}
Test::H9 => test_h9(&nctx, &mut client),
Test::H3 => test_h3(&nctx, peer, client, test),
Test::H3 | Test::D => test_h3(&nctx, peer, client, test),
Test::VN => unimplemented!(),
Test::R => test_h3_rz(&nctx, peer, client, test),
Test::Z => test_h3_rz(&nctx, peer, client, test),
Test::D => test_h3(&nctx, peer, client, test),
Test::R | Test::Z => test_h3_rz(&nctx, peer, client, test),
};

if let Err(e) = res {
Expand Down
9 changes: 3 additions & 6 deletions neqo-transport/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ impl Connection {
let res = self.client_start(now);
self.absorb_error(now, res);
}
(State::Init, Role::Server) | (State::WaitInitial, Role::Server) => {
(State::Init | State::WaitInitial, Role::Server) => {
return Output::None;
}
_ => {
Expand Down Expand Up @@ -1292,8 +1292,7 @@ impl Connection {
self.handle_retry(packet, now);
return Ok(PreprocessResult::Next);
}
(PacketType::Handshake, State::WaitInitial, Role::Client)
| (PacketType::Short, State::WaitInitial, Role::Client) => {
(PacketType::Handshake | PacketType::Short, State::WaitInitial, Role::Client) => {
// This packet can't be processed now, but it could be a sign
// that Initial packets were lost.
// Resend Initial CRYPTO frames immediately a few times just
Expand All @@ -1306,9 +1305,7 @@ impl Connection {
self.crypto.resend_unacked(PacketNumberSpace::Initial);
}
}
(PacketType::VersionNegotiation, ..)
| (PacketType::Retry, ..)
| (PacketType::OtherVersion, ..) => {
(PacketType::VersionNegotiation | PacketType::Retry | PacketType::OtherVersion, ..) => {
self.stats
.borrow_mut()
.pkt_dropped(format!("{:?}", packet.packet_type()));
Expand Down
3 changes: 1 addition & 2 deletions neqo-transport/src/qlog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ pub fn connection_state_updated(qlog: &mut NeqoQlog, new: &State) {
let ev_data = EventData::ConnectionStateUpdated(ConnectionStateUpdated {
old: None,
new: match new {
State::Init => ConnectionState::Attempted,
State::WaitInitial => ConnectionState::Attempted,
State::Init | State::WaitInitial => ConnectionState::Attempted,
State::WaitVersion | State::Handshaking => ConnectionState::HandshakeStarted,
State::Connected => ConnectionState::HandshakeCompleted,
State::Confirmed => ConnectionState::HandshakeConfirmed,
Expand Down

0 comments on commit 895f15d

Please sign in to comment.