Skip to content

Commit cf4b8f9

Browse files
fix(lint): clear Rust 1.96 clippy debt (14 lints) + criterion black_box deprecation (#308)
CI's toolchain rolled to Rust 1.96; `cargo clippy --all-targets -- -D warnings` now fails on 14 pre-existing lints in `corpus/`, `exchange/smtlib.rs` and `verification/pareto_arbiter.rs`, plus deprecated `criterion::black_box` in both bench targets. These were invisible while the fmt red (#305) short-circuited the rust-ci job, and they block every PR's rust-ci (first seen on #306, whose own module is clippy-clean). All fixes are mechanical with no behaviour change. `cargo clippy --all-targets` clean locally; 1174 lib tests green; `cargo fmt --check` clean. Unblocks rust-ci for #306 and keeps the main-green clock (L3→L1 gate) alive. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 2cb0ceb commit cf4b8f9

10 files changed

Lines changed: 32 additions & 31 deletions

File tree

benches/proof_benchmarks.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
//! Run with: cargo bench
77
//! Generates HTML reports in target/criterion/
88
9-
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
9+
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
10+
use std::hint::black_box;
1011

1112
use echidna::core::{Context, Goal, Hypothesis, ProofState, Term};
1213
use echidna::provers::{ProverConfig, ProverFactory, ProverKind};

benches/routing_benchmarks.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
//! Run with: `cargo bench --bench routing_benchmarks`
1515
//! Generates HTML reports in `target/criterion/`
1616
17-
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
17+
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
18+
use std::hint::black_box;
1819

1920
use echidna::agent::AgentConfig;
2021
use echidna::dispatch::DispatchConfig;

src/rust/corpus/acl2_books.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,10 @@ fn classify_form(form: &str, line: usize, pf: &mut ParsedFile) {
361361
if name.is_empty() {
362362
return;
363363
}
364-
let mut hz = AxiomUsage::default();
365-
hz.postulate = true;
364+
let mut hz = AxiomUsage {
365+
postulate: true,
366+
..Default::default()
367+
};
366368
hz.other.push("defaxiom".to_string());
367369
flag_hazards(rest_body, &mut hz);
368370
pf.decls.push(DraftDecl {
@@ -379,8 +381,10 @@ fn classify_form(form: &str, line: usize, pf: &mut ParsedFile) {
379381
if name.is_empty() {
380382
return;
381383
}
382-
let mut hz = AxiomUsage::default();
383-
hz.postulate = true;
384+
let mut hz = AxiomUsage {
385+
postulate: true,
386+
..Default::default()
387+
};
384388
hz.other.push("defstub".to_string());
385389
pf.decls.push(DraftDecl {
386390
name,

src/rust/corpus/isabelle.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,8 @@ fn parse_theorem_like(
546546
}
547547
// `using … by …` and `unfolding … by …` patterns also
548548
// terminate on the trailing `by`.
549-
if t.contains(" by ") || t.ends_with(" by") {
550-
if !t.starts_with("proof") {
551-
terminated = true;
552-
}
549+
if (t.contains(" by ") || t.ends_with(" by")) && !t.starts_with("proof") {
550+
terminated = true;
553551
}
554552
}
555553
j += 1;

src/rust/corpus/metamath.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,10 @@ fn extract_module_name(src: &str) -> Option<String> {
314314
}
315315

316316
fn parse_mm_file(raw: &str) -> ParsedFile {
317-
let mut pf = ParsedFile::default();
318-
pf.module_name = extract_module_name(raw);
317+
let mut pf = ParsedFile {
318+
module_name: extract_module_name(raw),
319+
..Default::default()
320+
};
319321

320322
let toks = lex(raw);
321323
let mut scope_stack: Vec<String> = Vec::new();

src/rust/corpus/minif2f.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ fn terminators(ext: &str) -> &'static [&'static str] {
160160

161161
/// Identify the start-of-statement on a line and return
162162
/// `(opening_token_index, name)` if found.
163-
fn match_opening<'a>(line: &'a str, ext: &str) -> Option<(usize, String)> {
163+
fn match_opening(line: &str, ext: &str) -> Option<(usize, String)> {
164164
let trim = line.trim_start();
165165
for kw in opening_tokens(ext) {
166166
if let Some(rest) = trim.strip_prefix(*kw) {

src/rust/corpus/tptp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,9 @@ fn parse_annotated_formula(stmt: &str, line: usize) -> Option<DraftDecl> {
372372
for k in &kinds {
373373
if let Some(r) = stmt.strip_prefix(k) {
374374
let r2 = r.trim_start();
375-
if r2.starts_with('(') {
375+
if let Some(stripped) = r2.strip_prefix('(') {
376376
head = Some(k);
377-
rest = Some(&r2[1..]);
377+
rest = Some(stripped);
378378
break;
379379
}
380380
}

src/rust/corpus/why3.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ fn parse_envelope(
329329
}
330330

331331
// Imports / clones inside the envelope.
332-
for k in (start + 1)..body_end {
333-
let t = lines[k].trim_start();
332+
for line in lines.iter().take(body_end).skip(start + 1) {
333+
let t = line.trim_start();
334334
let import_rest = t
335335
.strip_prefix("use import ")
336336
.or_else(|| t.strip_prefix("use export "))

src/rust/exchange/smtlib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ impl SmtLibExchange {
144144
}
145145
}
146146

147-
infos.sort_by(|a, b| key_of(a).cmp(&key_of(b)));
148-
options.sort_by(|a, b| key_of(a).cmp(&key_of(b)));
149-
sorts.sort_by(|a, b| key_of(a).cmp(&key_of(b)));
150-
funs.sort_by(|a, b| key_of(a).cmp(&key_of(b)));
147+
infos.sort_by_key(key_of);
148+
options.sort_by_key(key_of);
149+
sorts.sort_by_key(key_of);
150+
funs.sort_by_key(key_of);
151151
// defs preserve original order: dependencies between defines are
152152
// significant and we don't track them here.
153153

src/rust/verification/pareto_arbiter.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,15 @@ pub struct AttemptOutcome {
3535

3636
/// How to pick a recommendation when multiple frontier points
3737
/// remain after Pareto filtering.
38-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
38+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
3939
pub enum Tiebreak {
40+
#[default]
4041
MinAxiom,
4142
MinLatency,
4243
MaxConfidence,
4344
MinCertificate,
4445
}
4546

46-
impl Default for Tiebreak {
47-
fn default() -> Self {
48-
Tiebreak::MinAxiom
49-
}
50-
}
51-
5247
/// Arbitration decision: the frontier, a recommendation, and how
5348
/// many of the inputs were dominated.
5449
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -153,6 +148,7 @@ impl Default for ParetoArbiter {
153148
/// - a.axiom_cost <= b.axiom_cost
154149
/// - a.certificate_size_bytes <= b.certificate_size_bytes
155150
/// - a.confidence >= b.confidence
151+
///
156152
/// AND at least one of these is strict.
157153
fn dominates(a: &AttemptOutcome, b: &AttemptOutcome) -> bool {
158154
let no_worse = a.latency_ms <= b.latency_ms
@@ -162,11 +158,10 @@ fn dominates(a: &AttemptOutcome, b: &AttemptOutcome) -> bool {
162158
if !no_worse {
163159
return false;
164160
}
165-
let strictly_better = a.latency_ms < b.latency_ms
161+
a.latency_ms < b.latency_ms
166162
|| a.axiom_cost < b.axiom_cost
167163
|| a.certificate_size_bytes < b.certificate_size_bytes
168-
|| a.confidence > b.confidence;
169-
strictly_better
164+
|| a.confidence > b.confidence
170165
}
171166

172167
#[cfg(test)]

0 commit comments

Comments
 (0)