Skip to content

Commit

Permalink
ci: Run clippy for all features except gecko (#1768)
Browse files Browse the repository at this point in the history
* ci: Run `clippy` for all features except `gecko`

* Make clippy happy

* Update .github/workflows/check.yml

Co-authored-by: Max Inden <[email protected]>
Signed-off-by: Lars Eggert <[email protected]>

---------

Signed-off-by: Lars Eggert <[email protected]>
Co-authored-by: Max Inden <[email protected]>
  • Loading branch information
larseggert and mxinden authored Mar 25, 2024
1 parent d8eedda commit 50876af
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
# respective default features only. Can reveal warnings otherwise
# hidden given that a plain cargo clippy combines all features of the
# workspace. See e.g. https://github.com/mozilla/neqo/pull/1695.
cargo +${{ matrix.rust-toolchain }} hack clippy --all-targets -- -D warnings || ${{ matrix.rust-toolchain == 'nightly' }}
cargo +${{ matrix.rust-toolchain }} hack clippy --all-targets --feature-powerset --exclude-features gecko -- -D warnings || ${{ matrix.rust-toolchain == 'nightly' }}
if: success() || failure()

- name: Check rustdoc links
Expand Down
3 changes: 3 additions & 0 deletions neqo-crypto/src/aead_fuzzing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub struct FuzzingAead {
}

impl FuzzingAead {
#[allow(clippy::missing_errors_doc)]
pub fn new(
fuzzing: bool,
version: Version,
Expand All @@ -44,6 +45,7 @@ impl FuzzingAead {
}
}

#[allow(clippy::missing_errors_doc)]
pub fn encrypt<'a>(
&self,
count: u64,
Expand All @@ -61,6 +63,7 @@ impl FuzzingAead {
Ok(&output[..l + 16])
}

#[allow(clippy::missing_errors_doc)]
pub fn decrypt<'a>(
&self,
count: u64,
Expand Down
2 changes: 1 addition & 1 deletion neqo-crypto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

mod aead;
#[cfg(feature = "fuzzing")]
mod aead_fuzzing;
pub mod aead_fuzzing;
pub mod agent;
mod agentio;
mod auth;
Expand Down
16 changes: 9 additions & 7 deletions neqo-transport/benches/range_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,32 @@ const CHUNK: u64 = 1000;
const END: u64 = 100_000;
fn build_coalesce(len: u64) -> RangeTracker {
let mut used = RangeTracker::default();
used.mark_acked(0, CHUNK as usize);
used.mark_sent(CHUNK, END as usize);
let chunk = usize::try_from(CHUNK).expect("should fit");
used.mark_acked(0, chunk);
used.mark_sent(CHUNK, usize::try_from(END).expect("should fit"));
// leave a gap or it will coalesce here
for i in 2..=len {
// These do not get immediately coalesced when marking since they're not at the end or start
used.mark_acked(i * CHUNK, CHUNK as usize);
used.mark_acked(i * CHUNK, chunk);
}
used
}

fn coalesce(c: &mut Criterion, count: u64) {
let chunk = usize::try_from(CHUNK).expect("should fit");
c.bench_function(
&format!("coalesce_acked_from_zero {count}+1 entries"),
|b| {
b.iter_batched_ref(
|| build_coalesce(count),
|used| {
used.mark_acked(CHUNK, CHUNK as usize);
used.mark_acked(CHUNK, chunk);
let tail = (count + 1) * CHUNK;
used.mark_sent(tail, CHUNK as usize);
used.mark_acked(tail, CHUNK as usize);
used.mark_sent(tail, chunk);
used.mark_acked(tail, chunk);
},
criterion::BatchSize::SmallInput,
)
);
},
);
}
Expand Down
4 changes: 2 additions & 2 deletions neqo-transport/benches/rx_stream_orderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ fn rx_stream_orderer() {
let mut rx = RxStreamOrderer::new();
let data: &[u8] = &[0; 1337];

for i in 0..100000 {
for i in 0..100_000 {
rx.inbound_frame(i * 1337, data);
}
}

fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("RxStreamOrderer::inbound_frame()", |b| {
b.iter(rx_stream_orderer)
b.iter(rx_stream_orderer);
});
}

Expand Down
8 changes: 4 additions & 4 deletions neqo-transport/benches/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ZERO: Duration = Duration::from_millis(0);
const JITTER: Duration = Duration::from_millis(10);
const TRANSFER_AMOUNT: usize = 1 << 22; // 4Mbyte

fn benchmark_transfer(c: &mut Criterion, label: &str, seed: Option<impl AsRef<str>>) {
fn benchmark_transfer(c: &mut Criterion, label: &str, seed: &Option<impl AsRef<str>>) {
let mut group = c.benchmark_group("transfer");
group.throughput(Throughput::Bytes(u64::try_from(TRANSFER_AMOUNT).unwrap()));
group.noise_threshold(0.03);
Expand All @@ -45,7 +45,7 @@ fn benchmark_transfer(c: &mut Criterion, label: &str, seed: Option<impl AsRef<st
sim.run();
},
SmallInput,
)
);
});
group.finish();
}
Expand All @@ -54,15 +54,15 @@ fn benchmark_transfer_variable(c: &mut Criterion) {
benchmark_transfer(
c,
"Run multiple transfers with varying seeds",
std::env::var("SIMULATION_SEED").ok(),
&std::env::var("SIMULATION_SEED").ok(),
);
}

fn benchmark_transfer_fixed(c: &mut Criterion) {
benchmark_transfer(
c,
"Run multiple transfers with the same seed",
Some("62df6933ba1f543cece01db8f27fb2025529b27f93df39e19f006e1db3b8c843"),
&Some("62df6933ba1f543cece01db8f27fb2025529b27f93df39e19f006e1db3b8c843"),
);
}

Expand Down
2 changes: 1 addition & 1 deletion neqo-transport/src/connection/tests/fuzzing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#![cfg(feature = "fuzzing")]

use neqo_crypto::FIXED_TAG_FUZZING;
use neqo_crypto::aead_fuzzing::FIXED_TAG_FUZZING;
use test_fixture::now;

use super::{connect_force_idle, default_client, default_server};
Expand Down
5 changes: 3 additions & 2 deletions neqo-transport/src/connection/tests/handshake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ use neqo_common::{event::Provider, qdebug, Datagram};
use neqo_crypto::{
constants::TLS_CHACHA20_POLY1305_SHA256, generate_ech_keys, AuthenticationStatus,
};
#[cfg(not(feature = "fuzzing"))]
use test_fixture::datagram;
use test_fixture::{
assertions, assertions::assert_coalesced_0rtt, datagram, fixture_init, now, split_datagram,
DEFAULT_ADDR,
assertions, assertions::assert_coalesced_0rtt, fixture_init, now, split_datagram, DEFAULT_ADDR,
};

use super::{
Expand Down

0 comments on commit 50876af

Please sign in to comment.