refactor(lint): replace crate-wide lint allowances with scoped exceptions - #830
Conversation
|
@TheWeirdDee Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Update: CI's clippy job runs whatever Rust/Clippy is currently
|
|
@TheWeirdDee Please fix CI issues |
…all) Same fix as Nanle-code#759/Nanle-code#830: database.rs used thiserror::Error/#[error(...)] without thiserror being a declared dependency, and passed &mut Transaction where the Migration trait expects &mut Connection (Transaction has no DerefMut). Switched the trait to &Connection. commands/mod.rs and utils/mod.rs were both missing `pub mod ai_doc_qa;` from the ai-documentation-Q&A merge (Nanle-code#718), so main.rs referenced modules that didn't exist. Without this, no CI job on this PR can even attempt to compile the crate.
…ions src/lib.rs and src/main.rs carried a blanket matching [lints] table listing 16 individually-named lints. Together these silenced every default Clippy lint group (correctness, suspicious, style, complexity, perf) plus dead_code/unused_imports/ unused_variables across the entire crate — not just the handful of patterns the comments claimed to justify. Removing both surfaced ~2021 warnings under `cargo clippy --all-features`. Of those: - 94% (1658) were the single mechanical `uninlined_format_args` style lint, applied via `cargo clippy --fix` (two passes to converge, after fixing one clippy suggestion that didn't actually compile: removing `.to_string()` from a String/&str comparison in audit.rs that only worked because it allocated a matching String). - ~160 more were fixed by hand: manual_clamp, ptr_arg (with the attendant &PathBuf/&Path .clone() semantics fix at each call site), needless_range_loop, vec_init_then_push, if_same_then_else (two genuine redundant-branch merges), a should_implement_trait rename, a handful of type_complexity type aliases, and other one-off style fixes. - One of those fixes was a real bug, not just style: a constructed template changelog entry was built and then silently discarded (`changelog: None` instead of `Some(changelog)`) in templates.rs — vec_init_then_push flagged the construction, but the value was never used at all. - The remaining 55 (26 too_many_arguments, 29 dead_code) are now scoped #[allow(...)] on the specific function/struct/field that needs it, each with a comment explaining why, instead of a crate-wide suppression that hid everything else behind them. Also fixes two default-build-only warnings that were only ever hidden by the same blanket: hardware_wallet.rs's Ledger APDU codec helpers are dead when built without --features hardware-wallet and without tests (now an honest, scoped cfg_attr instead of silence), and profiler.rs had a genuinely pointless `#[cfg(not(feature = "memory-profiling"))] let memory_tracker = None;` plus its supporting placeholder struct, neither of which anything ever used — deleted outright rather than allowed. `cargo clippy --all-features --locked -- -D warnings` (exactly what CI runs) now passes with zero warnings, with every remaining exception scoped and documented rather than silenced project-wide. Updates CODE_STYLE_STANDARDS.md's "Project-Specific Allowances" section, which previously described the now-removed blanket as if it only covered a few narrow cases.
CI's clippy job pulled Rust/Clippy 1.98.0 (dtolnay/rust-toolchain@stable
tracks whatever's current), ~9 minor versions ahead of the 1.89.0
toolchain this branch was originally validated against locally.
Clippy periodically adds new lints to its default groups between
releases, and clippy::all being removed (previous commit) means every
one of those newly-added lints is now live on this crate too.
Installed the matching stable toolchain locally and fixed everything
it flagged that 1.89 didn't know about: unnecessary_sort_by (7,
mostly `.sort_by(|a,b| b.x.cmp(&a.x))` → `.sort_by_key(|a|
Reverse(a.x))` after auto-fix declined the ones needing Reverse),
manual_checked_ops (2, `if total > 0 {x/total} else {0}` →
`x.checked_div(total).unwrap_or(0)`), explicit_counter_loop (a
manually-incremented line counter replaced with `(1u32..).zip(lines)`),
and unnecessary_unwrap (an `if x.is_some() { x.unwrap() }` replaced
with `if let Some(x) = x`). The rest (useless_borrows_in_formatting,
collapsible_match, derivable_impls, filter_next, manual_is_multiple_of,
useless_format) were machine-applicable via `cargo clippy --fix`.
`cargo clippy --all-features --locked -- -D warnings` now passes clean
under both the 1.89.0 toolchain this branch started on and the
1.98.0 stable CI actually runs.
The should_implement_trait rename (SkillLevel::from_str -> parse_lenient, in the first commit of this branch) only searched src/ for call sites. tests/template_recommendation.rs — a top-level integration test file — had two more, which broke its compilation. Found via CI's deploy-verify job actually attempting to compile it.
a02bab9 to
f316e97
Compare
- tests/ai_test_assistant.rs: two of the three generator helpers it
exercises (generate_edge_case_descriptions, generate_security_checks,
generate_warnings) had been relocated from utils::ai_test_assistant
into commands::ai_test as private fns, breaking the integration test.
Moved them back to utils::ai_test_assistant as pub fns (their natural
home alongside generate_test_priorities) and pointed commands::ai_test
at them instead of duplicating the logic. Also added a missing
.unwrap() the test needed after analyze_contract_for_testing started
returning a Result.
- tests/template_recommendation.rs: make_entry() predated the
categories/featured/repository_url fields on TemplateEntry.
- cargo fmt --all: fixed formatting drift left behind by earlier
clippy --fix passes that don't themselves run rustfmt.
- deny.toml: removed a stale RUSTSEC-2026-0190 ignore that no longer
matches any crate in the dependency tree (cargo-deny treats an
unmatched ignore as a failure).
- fuzz/Cargo.lock: regenerated; it had drifted out of sync with
fuzz/Cargo.toml since it was last committed.
- .github/workflows/benchmark-latency.yml: `cargo bench --locked --
cli_cold_start cli_command_latency latency_budget` passed three
positional filters, but Criterion's harness only accepts one -
combined into a single regex alternation. Also wrapped the PR-comment
step in try/catch: fork PRs get a read-only GITHUB_TOKEN and can't
post comments, which was failing the whole job even on a successful
benchmark run.
- templates/registry.json: SecurityReview.findings is Option<String>
(consuming code checks `.is_empty()`), but the bundled seed data has
always shipped numeric values (0, 1, null), so the CLI's offline
fallback path (no cache, no network) has never actually been able to
parse its own bundled registry. Converted 0 -> null and 1 -> "1" to
match the type, and added a regression test that parses
DEFAULT_REGISTRY directly.
- src/utils/database.rs: initialize() used
`self.get_meta("schema_version").is_ok()` to decide whether a
database was already initialized, but get_meta returns
Result<Option<String>> - Ok(None) is still Ok. On a genuinely fresh
database this took the "already initialized" branch and called
run_migrations() against an empty meta table, which fails with
"Schema version not found or invalid" - breaking every fresh install.
Changed the check to `.is_some()`.
- src/utils/test_optimizer.rs: two bugs.
1. batch_tests_by_profile computed the non-IO-bound tests into a
variable and then never used it, batching an always-empty
placeholder instead - CPU-bound, memory-bound, and general tests
were silently dropped from every batch.
2. save_state() didn't create config_dir before writing into it,
unlike new(); only worked by accident when the directory happened
to already exist.
- tests/contract_property_tests.rs: two tests with incorrect premises.
prop_magic_header_short_rejected generated 4-7 extra bytes on top of
a 4-byte magic header (8-11 bytes total), which is never "short" by
validate_wasm's own >= 8 threshold; narrowed the range so the total
is always < 8. prop_env_reset_preserves_ledger asserted
auth_count() > 0 after only calling auto_approve(), which just
registers an allow-list entry and does not itself record an auth
attempt; added a require_auth() call so there's actually a record to
clear.
Same underlying crisis already fixed on fix/684-archive-path-traversal (commit e7abe69) - this branch was rebased from upstream/master directly and never received it. Cherry-picked here since the bugs are identical: bindings.rs duplicate read_spec_entries, audit.rs duplicate ci_passed field, compliance.rs missing PartialEq, ai.rs non-mut binding, templates.rs/template_analytics.rs/template_recommender.rs TemplateEntry test literals missing recently-added fields, and plugins/registry.rs missing the description field and resolve_plugin_description/plugin_list_entries helpers (also wired into commands/plugin.rs, fixing the always-blank Description column in `starforge plugin list`).
…py --fix An earlier automated clippy --fix pass on this branch removed imports and renamed a parameter it saw as unused in non-test analysis, but each was genuinely used by #[cfg(test)] code (or, for plugins/registry.rs, became used again once the crisis-fix cherry-pick restored the code that reads it): - commands/feature_flags_cmd.rs: MetricKind, used only in the test module's roundtrip test. - utils/feature_flags.rs: BTreeMap, used only in one dry-run test. - utils/network_simulator/simulator.rs: FailureMode, used only in a failure-injection test. - utils/security/ai_audit_service.rs: AuditLevel, used only in the AuditRequest construction tests. - plugins/registry.rs: install_plugin's description param had been renamed to _description (unused-marker) before the crisis-fix cherry -pick added the line that stores it; renamed back now that it's genuinely read. Scoped each import into its #[cfg(test)] mod rather than restoring it at the top level, so it doesn't reintroduce an unused-import warning in non-test builds. cargo test --lib --all-features --no-run and cargo clippy --all-features --locked -- -D warnings both pass clean.
|
@TheWeirdDee resolve conflicts |
…CI verification - tests/multisig_builder_ui.rs: update calls to match the current multisig_builder API (proposal_from_template now takes a network argument; render_progress_bar takes a &SignatureProgress computed via calculate_progress and returns a single formatted string, not a tuple). - tests/test_optimizer_integration.rs: TestOptimizer::history is a HashMap<String, TestHistory>, but call sites were passing the make_history() (String, TestHistory) tuple directly to insert(), which takes two separate arguments. Switched to extend([...]) which accepts (K, V) tuples directly. - src/utils/test_optimizer.rs: TestOptimizer::config_dir and ::cache were private, which the same integration test needs to construct the struct directly from outside the crate. Made them pub, consistent with the already-public history field. - tests/template_recommendation.rs: same findings: Some(0) -> None fix already applied on fix/666-hardware-wallet-ci. Same fixes as fix/666-hardware-wallet-ci, each verified there with isolated `cargo test --test <name> --no-run` compile checks.
|
@TheWeirdDee Please resolve conflicts and Fix the CI checks failure!!!! |
4c8ce80 merged an even newer upstream/master into this branch and reintroduced the same class of unresolved-duplicate-content bugs seen on other branches merging the same upstream state: git auto-resolves overlapping-but-not-conflicting insertions by keeping both sides' content instead of one, with no conflict markers, silently breaking the build. Also found and fixed several genuine logic bugs the merge exposed once the crate actually compiled, plus this PR's own zero-warnings clippy goal needed re-establishing under both the local Rust 1.89 toolchain and CI's actual 1.98.0 stable. Compile-breaking duplicate content (same pattern as before): - commands/plugin.rs, plugins/registry.rs, utils/ai_test_assistant.rs, utils/templates.rs, utils/template_analytics.rs, utils/template_recommender.rs, tests/template_recommendation.rs, tests/bindings_tests.rs, tests/multisig_builder_ui.rs: duplicate struct-literal fields, duplicate function definitions, and a concatenated-then-orphaned test-function body, mirroring the fixes already made on other branches sharing this master state. - Cargo.toml: duplicate `thiserror` key made `cargo metadata` itself fail, which is why every CI job failed in under 30 seconds. - .github/workflows/benchmark-latency.yml and fuzzing.yml: the same double-catch-block and duplicate-schedule-key bugs found before. - templates/registry.json: duplicate `findings` JSON keys (serde_json rejects these outright), breaking the bundled-registry fallback path. Newly found (this merge's diff was large enough that the same pattern also produced several deeper bugs that don't just fail to compile — they compile but do the wrong thing, or reference logic that got cut mid-body): - commands/nl.rs: two versions of the same for-loop (with different, intentional matching logic) were concatenated; kept the version matching the function's own doc comment. Also found and fixed the actual root cause of a real test failure this exposed: "show" was a filtered stop-word despite being a meaningful pattern keyword elsewhere in the same file, which caused "show wallet balance" to score higher against "list wallets" than "show wallet" once "show" was stripped from its keywords. - utils/ai_model_router.rs: duplicate struct-literal fields, and an `if` branch left with an empty body (type mismatch) from the same concatenation pattern — filled it in per the branch's own condition and adjusted a redundant branch that had become dead code. - utils/database.rs: a `#[derive(thiserror::Error)]` got split apart by a `use std::fmt;` import spliced into the middle of the attribute, paired with a redundant manual `impl Display` that duplicated it; plus three separate duplicate-declaration/duplicate-call bugs in rollback_migration and its tests (a moved-then-reused `Connection`, a re-fetched `Statement` that shadowed a working one, a duplicate migration-applied check). - utils/security/ai_audit.rs: same concatenated-loop pattern as nl.rs, in the reentrancy heuristic's "storage write after transfer" check; kept the more permissive (correct) condition. - utils/templates.rs: two entire implementations of `load_registry` (an old inline-TTL-check version and the current ETag-aware one with extracted helpers) were concatenated; removed the stale one. Lint-quality (this PR's actual purpose, re-verified from scratch after the above): with the crate compiling again, `cargo clippy --all-features --locked -- -D warnings` surfaced real findings on top of the merge damage — sort_by_key, collapsible-if x2, if-identical-blocks (merged with `||`, consistent with how this PR treats that lint elsewhere), two thread_local const-init suggestions, manual_strip, an io::Error::other suggestion, a let-and-return, two needless_range_loop, and a mem::take opportunity. Also replaced two Option::is_none_or and one u64::is_multiple_of call with MSRV 1.80-compatible equivalents (map_or / `% 3 == 0`) — those APIs weren't stabilized until 1.82/1.87, which the MSRV job would have caught. Verified locally: - cargo build (default and --features hardware-wallet) - cargo check --all-features --tests - cargo fmt --all --check - cargo clippy --all-features --locked -- -D warnings on both the local 1.89.0 toolchain AND (via `rustup run stable`, which resolves to 1.98.0 here) the exact toolchain CI actually runs — zero warnings on both - cargo check --locked --workspace on a real Rust 1.80.0 toolchain (MSRV job's exact command) — clean - cargo test --lib: 1403 passed. The 7 remaining failures are all Windows-local environment artifacts confirmed unrelated to any code change: dirs::home_dir() ignores HOME/USERPROFILE overrides on Windows (affects 5 tests relying on that for isolation — one already flagged on a prior branch), and two contract_versioning tests whose test-only TOML fixtures embed a raw Windows path containing backslash sequences TOML parses as unicode escapes. None of these reproduce on Linux CI, where paths use forward slashes and HOME overrides work as documented. - cargo test --test bindings_tests, --test multisig_builder_ui: full pass (8/8, 4/4).
Resolves conflicts introduced by master advancing since the last merge (commits through 769391f, including the template registry schema validator and Windows-test-isolation fixes from Nanle-code#866/Nanle-code#842): - src/commands/nl.rs: keep master's exclusion of "invoke" from the function-name trigger list (documented immediately above the conflict) with the single-if `&&`-guard style. - src/plugins/registry.rs: drop the stale InstalledPlugin-returning resolve_plugin_description/plugin_list_entries pair that master reintroduced; the PluginListEntry-based versions later in the file are the real implementation. - src/utils/database.rs: keep master's max_applied `<` comparison (with explanatory comment) over the redundant duplicate "not applied" check; keep the `_conn`-named MigrationV1::up to avoid an unused-variable warning. - src/utils/security/ai_audit.rs: keep master's more thorough writes_state check (storage+set, .set(, or set_) with its explanatory comment. - src/utils/test_optimizer.rs: keep master's unconditional create_dir_all (create_dir_all is already idempotent). - tests/test_optimizer_integration.rs: adopt master's insert_history helper consistently in both places HEAD still used the older opt.history.extend([...]) form. Also fixes issues surfaced by rebuilding after the merge (none of these are merge-conflict artifacts; the code compiled and looked correct until checked against CI's exact toolchain): - src/commands/template.rs, src/utils/template.rs: add the missing `use colored::Colorize` import needed by the new `template validate` command's colored output; drop two now-invalid `.clone()` calls on `Option<u32>` (findings changed from String to a Copy type upstream). - src/utils/ai_doc_qa.rs, src/commands/upgrade_auto.rs, src/utils/ai_search.rs, src/utils/contract_assertions.rs, src/utils/pipeline_builder.rs, tests/bindings_tests.rs, tests/test_optimizer_integration.rs: remove unused imports/bindings left over from upstream changes. Verified: cargo build (default + --features hardware-wallet), cargo check --all-features --tests, cargo fmt --all --check, cargo clippy --all-features --locked -- -D warnings (rustup run stable, matching CI's toolchain exactly), rustup run 1.80.0 cargo check --locked --workspace (MSRV), cargo test --lib (1446 passed), and the bindings_tests/multisig_builder_ui/test_optimizer_integration test binaries (22 passed).
Master advanced from 769391f to 496357e while the previous merge was being verified, adding the network-passphrase guard, cicd/pr commands, and related docs/CI templates (PR Nanle-code#867). Conflict resolved: - src/commands/network.rs: master's test_network rewrite parses latest_ledger/protocol_version/horizon_version from Horizon's root endpoint via a shared `client`, which the surrounding (unconflicted) code and the HorizonHealthDetails struct already expect. Took master's fetch, renamed the underscore-prefixed `_client` builder to `client` since it's now used, and dropped HEAD's redundant http_client::get_client() `/health` check (now-unused http_client import removed too). Also fixes clippy errors in the newly-merged code (real bugs in master, not merge artifacts — surfaced only once checked against CI's exact toolchain): - src/commands/cicd.rs: literal empty-format-string arg in println!. - src/commands/network.rs: redundant match on Result replaced with `.is_ok()`. - src/commands/pr.rs: collapsed a redundant nested if. - src/plugins/manifest.rs: match arms with a bool literal body rewritten as `matches!`. Verified: cargo build (default + --features hardware-wallet), cargo check --all-features --tests, cargo fmt --all --check, cargo clippy --all-features --locked -- -D warnings (rustup run stable, matching CI), rustup run 1.80.0 cargo check --locked --workspace (MSRV), and cargo test --lib (1472 passed).
…in deployment_timeline.rs The merge of master into this branch (7afdbbf) left PluginManager::execute in src/plugins/loader.rs syntactically broken: both sides of a real conflict (the old direct-execute path from this branch, and master's new panic-isolating rewrite from PR Nanle-code#879) were concatenated instead of resolved, so the crate did not compile. Keeps master's version, which catches a panicking plugin via catch_unwind instead of taking down the whole CLI. Also fixes two issues in deployment_timeline.rs (new in this merge, from PR Nanle-code#880) surfaced only once checked against CI's exact toolchain: a missing named lifetime on the `pending_then` test fixture (its return type borrows from its argument, so `PollFn<'_>` doesn't elide), and an unnecessary `mut` on an unused binding. src/commands/deployments.rs and src/utils/config.rs are rustfmt-only diffs from `cargo fmt --all` on files this merge introduced. Verified: cargo build (default + --features hardware-wallet), cargo check --all-features --tests, cargo fmt --all --check, cargo clippy --all-features --locked -- -D warnings (rustup run stable, matching CI), rustup run 1.80.0 cargo check --locked --workspace (MSRV), and cargo test --lib (1512 passed).
CI on 55d73c7 was actually green except for 4 checks, all tracing to two root causes: - src/utils/ai_test_assistant.rs: generate_test_priorities required complexity_score > 3 for a mutating function to reach High priority. That gate was my own earlier consolidation of a merge-duplicate block in this branch's history, but it's wrong: a mutating, non-entry-point function (e.g. a token transfer) should always be at least High priority regardless of how simple its body looks — test_priorities_rank_mutating_functions in tests/ai_test_assistant.rs asserts exactly this and was failing (Build and Test, Coverage Report, and Property-Based Tests all failed on this one assertion). is_mutating now yields High unconditionally; complexity_score > 5 still lifts a non-mutating function to Medium. - .github/workflows/audit.yml: the Cargo Audit job (added by PR Nanle-code#867) was failing on 5 real advisories that audit.toml already documents as accepted risk with justification — but rustsec/[email protected] does not read that file; it only takes advisory IDs via its own `ignore` input (confirmed against the action's action.yml). Wired the same 9 IDs from audit.toml into that input so the intended exceptions actually take effect. Verified locally: cargo test --test ai_test_assistant (30 passed), cargo test --lib (1512 passed), cargo build (default + --features hardware-wallet), cargo fmt --all --check, cargo clippy --all-features --locked -- -D warnings (rustup run stable, matching CI), rustup run 1.80.0 cargo check --locked --workspace (MSRV). The audit.yml fix itself can only be confirmed by CI actually running rustsec/audit-check against it.
Closes #651.
Objective
Restore useful compiler and Clippy signals while documenting necessary local exceptions.
What was there before
src/lib.rsandsrc/main.rsboth carried:#![allow(dead_code, unused, clippy::all)]clippy::alldisables essentially every default Clippy lint group (correctness, suspicious, style, complexity, perf) for the whole crate.unuseddisablesunused_imports/unused_variables/etc. crate-wide too. On top of that,Cargo.tomlhad a[lints]table individually naming 16 more lints as"allow", with a comment claiming they were "intentionally relaxed... to keepcargo clippy --all-targets -- -D warningsgreen" — but theCargo.tomltable was almost entirely redundant with the much bigger hammer already swinging inlib.rs/main.rs.Net effect: nobody had real Clippy signal on this crate.
cargo clippy --all-featureslooked clean not because the code was clean, but because nearly everything was silenced.What changed
Removed both the crate-root
#![allow(...)]and theCargo.toml[lints]table entirely. That surfaced 2021 warnings undercargo clippy --all-features. Here's what happened to them:94% (1658) were
uninlined_format_args—format!("{}", x)vsformat!("{x}"), purely cosmetic. Applied viacargo clippy --fix --all-features(took two passes to converge, and one manual fix first: the initial--fixattempt failed wholesale because one of its own suggestions didn't actually compile — removing.to_string()from aString < &strcomparison inaudit.rsthat only worked because it allocated a matchingString;Stringdoesn't implementPartialOrd<&str>directly. Fixed that one by hand with.as_str()first, then the rest of the batch applied cleanly).~160 more fixed by hand, grouped by lint:
manual_clamp(8) —.max(a).min(b)→.clamp(a, b).ptr_arg(8) —&PathBuf/&mut Vec<T>params narrowed to&Path/&mut [T]. This one bit back: two call sites didpath.clone()expecting an ownedPathBuf(which works on&PathBufvia method-resolution autoderef) — after narrowing to&Path,.clone()silently started returning&Pathinstead (copying the reference, sincePathisn'tClone), which the compiler caught immediately as a type mismatch. Fixed with.to_path_buf().needless_range_loop(6) —for j in a..b { lines[j] }→ iterate a slice directly.vec_init_then_push(3) — one of these was a real bug, not just style:templates.rsbuilt achangelog: Vec<ChangelogEntry>with an "Initial release" entry viaVec::new()+.push(), then setTemplateEntry { changelog: None, ... }right below it, completely ignoring the local variable. Fixed tochangelog: Some(changelog). (The other two multi-push sites got a scoped#[allow(clippy::vec_init_then_push)]instead — 8 and 2 sequential multi-line struct-literal pushes read far more clearly than one giantvec![]literal.)if_same_then_else(2) — both were "two different conditions, same intentional outcome," not copy-paste bugs; merged with||.should_implement_trait(1) —SkillLevel::from_str(&str) -> Option<Self>was shadowing/confusable withFromStr::from_str(which returnsResult). Renamed toparse_lenientand updated its 2 call sites.type_complexity(4) — addedtypealiases for aRwLock<HashMap<...Box<dyn AIService>...>>struct field, a tuple-keyed telemetry aggregation map, a security-sensitive encrypted-bundle-parsing tuple return, and a publicVec<(String, String, i64, i64, i64, f64)>API return type.manual_strip,wildcard_in_or_patterns,doc_overindented_list_items,cloned_ref_to_slice_refs,only_used_in_recursion(dropped an unused&selffrom a recursive helper, converting it toSelf::topological_sort(...)), and 2 genuinely unused imports.The remaining 55 (26
too_many_arguments, 29dead_code) are now scoped#[allow(...)]on the exact function/struct/field that needs it, each with a comment explaining why — not a crate-wide suppression hiding everything else behind them.too_many_argumentsmostly affects CLI command handlers where each parameter is an independent named flag; bundling them into a config struct wouldn't reduce real complexity.dead_codeis honestly annotated as "not currently called from any code path in this crate; kept rather than removed since deleting it is a product decision, not a lint-scoping one" — I did not go delete two dozen functions I don't have full context on as part of a lint-policy PR.Two more warnings only surfaced in a default build (no
--all-features, no tests) and needed their own fix rather than--fix:hardware_wallet.rs's Ledger APDU codec helpers (constants +build_apdu/parse_hd_path/etc.) are only used by thehardware-walletfeature's transport code and by this module's own tests — genuinely unused in the one configuration that has neither. Added a module-level#![cfg_attr(not(any(test, feature = "hardware-wallet")), allow(dead_code))]with a comment explaining exactly that, instead of silence.profiler.rshad#[cfg(not(feature = "memory-profiling"))] let memory_tracker: Option<MemoryTracker> = None;plus a placeholderstruct MemoryTracker;that existed solely to give that dead assignment a type — neither was ever read when the feature was off. Deleted both outright rather than allowing them, since they served no purpose at all.Documentation
Rewrote
CODE_STYLE_STANDARDS.md's "Project-Specific Allowances" section, which previously described the (now-removed) blanket allowlist as if it only covered a handful of specific, narrow patterns. It now explains the scoped-exception policy, what to do (and not do) when adding one, and — as a concrete illustration of why blanket allows are dangerous — the changelog bug this cleanup found.Testing / verification
cargo clippy --all-features --locked -- -D warnings— exactly what CI'sclippyjob runs — passes with zero warnings.cargo build --locked(default features, matchingbuild-and-test's first step) passes with zero warnings (previously would have shown 15+, now that the blanket's gone — see thehardware_wallet.rs/profiler.rsfixes above).cargo fmt --checkon every touched file is clean (ranrustfmtacross the full touched-file set as part of this change, since a lint-quality PR is exactly the right place to also normalize formatting drift in the same files).cargo clippy --all-features --message-format=jsonand diffing the remaining warning list, to make sure nothing regressed and no fix introduced a new warning class.Scope note: master's pre-existing build breakage
Before any of the above could be verified, I had to get the crate compiling at all —
mastercurrently failscargo buildfor two small, unrelated, pre-existing reasons (already fixed standalone in #759, reapplied here as a prerequisite commit since this issue's work is fundamentally impossible to validate without a workingcargo clippy):database.rsusedthiserror::Error/#[error(...)]withoutthiserrorbeing a declared dependency, and passed&mut Transactionwhere theMigrationtrait expects&mut Connection(Transactionhas noDerefMut).commands/mod.rsandutils/mod.rswere both missingpub mod ai_doc_qa;from a recent merge (feat(ai): implement AI Documentation Q&A (#512) #718), somain.rsreferenced modules that didn't exist.Separately — and out of scope for this PR —
cargo clippy --all-targets(i.e. including test code) still hits a large, unrelated wave of pre-existing test-compile errors acrosstemplate_recommender.rs/template_analytics.rs/plugin registry code/etc. (missing struct fields, type mismatches). None of that is reachable bycargo clippy --all-features(no--all-targets, matching what CI'sclippyjob actually runs), so it doesn't block this PR, but it does meancargo test/cargo clippy --all-targetswon't be clean until that separate issue is addressed.