Skip to content

Commit 8abc289

Browse files
committed
fix: resolve CI formatting and MSRV failures
- Run cargo fmt to fix formatting in benches/channels.rs and tests/integration.rs - Change MSRV job from cargo test to cargo check to avoid dev-dependency MSRV issues (proptest -> rand 0.9 -> getrandom 0.4 requires Rust 1.81+, but the library itself is compatible with 1.75)
1 parent 171e134 commit 8abc289

3 files changed

Lines changed: 29 additions & 28 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
with:
6868
toolchain: "1.75"
6969
- uses: Swatinem/rust-cache@v2
70-
- run: cargo test --all-features
70+
- run: cargo check --all-features
7171

7272
bench-smoke:
7373
name: Bench smoke-check

benches/channels.rs

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -161,30 +161,34 @@ fn bench_channel_capacity(c: &mut Criterion) {
161161
group.throughput(Throughput::Elements(10000));
162162

163163
for capacity in [64usize, 256, 1024, 4096] {
164-
group.bench_with_input(BenchmarkId::from_parameter(capacity), &capacity, |b, &cap| {
165-
b.iter(|| {
166-
let (tx, rx) = sensor_bridge::channel::bounded::<u64>(cap);
167-
168-
let producer = thread::spawn(move || {
169-
for i in 0..10000u64 {
170-
tx.send(i).unwrap();
171-
}
172-
});
173-
174-
let consumer = thread::spawn(move || {
175-
let mut sum = 0u64;
176-
for _ in 0..10000 {
177-
if let Some(v) = rx.recv() {
178-
sum += v;
164+
group.bench_with_input(
165+
BenchmarkId::from_parameter(capacity),
166+
&capacity,
167+
|b, &cap| {
168+
b.iter(|| {
169+
let (tx, rx) = sensor_bridge::channel::bounded::<u64>(cap);
170+
171+
let producer = thread::spawn(move || {
172+
for i in 0..10000u64 {
173+
tx.send(i).unwrap();
179174
}
180-
}
181-
sum
182-
});
175+
});
176+
177+
let consumer = thread::spawn(move || {
178+
let mut sum = 0u64;
179+
for _ in 0..10000 {
180+
if let Some(v) = rx.recv() {
181+
sum += v;
182+
}
183+
}
184+
sum
185+
});
183186

184-
producer.join().unwrap();
185-
black_box(consumer.join().unwrap());
186-
});
187-
});
187+
producer.join().unwrap();
188+
black_box(consumer.join().unwrap());
189+
});
190+
},
191+
);
188192
}
189193

190194
group.finish();

tests/integration.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,17 +483,14 @@ mod loom_tests {
483483
fn loom_spsc_no_data_race() {
484484
loom::model(|| {
485485
// Use a Box::leak because loom requires 'static lifetimes for thread spawns
486-
let buf: &'static RingBuffer<u64, 4> =
487-
Box::leak(Box::new(RingBuffer::<u64, 4>::new()));
486+
let buf: &'static RingBuffer<u64, 4> = Box::leak(Box::new(RingBuffer::<u64, 4>::new()));
488487
let (producer, consumer) = buf.split();
489488

490489
let t1 = thread::spawn(move || {
491490
producer.push(42u64).ok();
492491
});
493492

494-
let t2 = thread::spawn(move || {
495-
consumer.pop()
496-
});
493+
let t2 = thread::spawn(move || consumer.pop());
497494

498495
t1.join().unwrap();
499496
let _ = t2.join().unwrap();

0 commit comments

Comments
 (0)