Skip to content

style(clippy): address some clippy warnings#1259

Draft
danieleades wants to merge 67 commits into
oxidecomputer:mainfrom
danieleades:code-quality
Draft

style(clippy): address some clippy warnings#1259
danieleades wants to merge 67 commits into
oxidecomputer:mainfrom
danieleades:code-quality

Conversation

@danieleades

@danieleades danieleades commented Dec 19, 2025

Copy link
Copy Markdown

Summary

Rebased onto current main and refreshed the Clippy cleanup with nightly across every workspace crate and Cargo target. Each lint is isolated in one commit, and every commit summary ends with the exact lint name.

The broad clippy::all boundary remains on emitted modules so newly introduced lints do not break downstream repositories. During this work the suppressed lint groups were force-enabled; generator-owned findings were fixed or documented with narrow, reasoned allowances.

Commit index

Compatibility, contracts, and intentional boundaries

  • fcd5e66 [stable/default] fix(clippy): retain the public error representation (clippy::result_large_err)
  • 60ada62 [stable/default] chore(lints): narrow the client hook suppression (unused_variables)
  • 5421f90 [pedantic] style(clippy): name concrete default types (clippy::default_trait_access)
  • 83dbf78 [pedantic] fix(clippy): reject oversized schema bounds (clippy::cast_possible_truncation)
  • 76e1638 [pedantic] docs(clippy): describe generation failures (clippy::missing_errors_doc)
  • 0f30bee [pedantic] docs(clippy): describe generation panic invariants (clippy::missing_panics_doc)
  • 3a10bda [pedantic] chore(clippy): document cohesive generation functions (clippy::too_many_lines)
  • a7c7726 [pedantic] chore(clippy): preserve explicit CLI execution modes (clippy::single_match_else)
  • c64a3ba [pedantic] chore(clippy): document numeric schema conversion (clippy::cast_precision_loss)
  • 6839bf3 [pedantic] chore(clippy): retain stream parameter lifetimes (clippy::elidable_lifetime_names)
  • 0b817b6 [pedantic] chore(clippy): isolate typify field naming (clippy::struct_field_names)
  • 43450f1 [nursery] chore(clippy): preserve path template placeholders (clippy::literal_string_with_formatting_args)
  • 56a515e [stable/default] chore(clippy): retain schema-shaped method parameters (clippy::too_many_arguments)
  • a123c0a [pedantic] chore(clippy): allow browser-local response futures on wasm (clippy::future_not_send)

Changes visible in emitted clients

  • 432a87b [pedantic] docs(clippy): mark code terms in documentation (clippy::doc_markdown)
  • 6025da7 [pedantic] docs(clippy): mark returned values as significant (clippy::must_use_candidate)
  • 0a1284a [pedantic] style(clippy): combine identical error match arms (clippy::match_same_arms)
  • 0d37ea9 [pedantic] style(clippy): remove trailing format argument commas (clippy::unnecessary_trailing_comma)
  • 96818d1 [pedantic] refactor(clippy): borrow generation inputs where possible (clippy::needless_pass_by_value)
  • acf5038 [nursery] refactor(clippy): make immutable helpers const (clippy::missing_const_for_fn)
  • 3ffc65c [stable/default] style(clippy): use shorthand for generated client fields (clippy::redundant_field_names)

Internal and mechanical cleanup

  • 1157204 [stable/default] style(clippy): simplify optional requirement check (clippy::unnecessary_map_or)
  • 84c0baf [stable/default] style(clippy): remove redundant format borrows (clippy::useless_borrows_in_formatting)
  • 09b23dc [stable/default] style(clippy): collapse nested response check (clippy::collapsible_if)
  • 4a4ab4f [stable/default] style(clippy): defer panic message formatting (clippy::expect_fun_call)
  • 4b52f71 [stable/default] refactor(clippy): implement Display for path templates (clippy::to_string_trait_impl)
  • eee7a19 [stable/default] style(clippy): insert an identifier character directly (clippy::single_char_add_str)
  • e24fe08 [stable/default] style(clippy): derive default generator styles (clippy::derivable_impls)
  • 04bf539 [stable/default] style(clippy): format path templates directly (clippy::to_string_in_format_args)
  • 3ad50a1 [stable/default] style(clippy): use arrays for fixed test cases (clippy::useless_vec)
  • 9d372d8 [stable/default] style(clippy): elide a constant static lifetime (clippy::redundant_static_lifetimes)
  • ea2abdf [stable/default] style(clippy): avoid an immediately dereferenced borrow (clippy::needless_borrow)
  • 353d816 [stable/default] style(clippy): name intentionally unused futures (clippy::let_underscore_future)
  • 56b2a56 [pedantic] style(clippy): inline formatting arguments (clippy::uninlined_format_args)
  • 622b568 [pedantic] style(clippy): nest shared response patterns (clippy::unnested_or_patterns)
  • a82c500 [pedantic] style(clippy): remove a redundant response else (clippy::redundant_else)
  • cedd56f [pedantic] style(clippy): remove unnecessary raw string hashes (clippy::needless_raw_string_hashes)
  • 7870791 [pedantic] style(clippy): copy static implementation names (clippy::cloned_instead_of_copied)
  • 76cd005 [pedantic] style(clippy): clone owned strings explicitly (clippy::implicit_clone)
  • e583db7 [pedantic] style(clippy): write into documentation buffers directly (clippy::format_push_string)
  • d324dcb [pedantic] refactor(clippy): pass optional components idiomatically (clippy::ref_option)
  • 67d745a [pedantic] style(clippy): terminate unit-returning statements (clippy::semicolon_if_nothing_returned)
  • fdc4cc6 [pedantic] style(clippy): branch directly on inner client state (clippy::match_bool)
  • f2fe5cf [pedantic] style(clippy): destructure response details with let-else (clippy::manual_let_else)
  • 6439ca2 [pedantic] style(clippy): collect builder parameters directly (clippy::unnecessary_join)
  • 67722fe [pedantic] style(clippy): use loops for builder tag generation (clippy::needless_for_each)
  • 1375b3e [pedantic] style(clippy): iterate over container references (clippy::explicit_iter_loop)
  • b4972b7 [pedantic] style(clippy): remove an unnecessary match semicolon (clippy::unnecessary_semicolon)
  • 8cd661b [pedantic] refactor(clippy): return generation values directly (clippy::unnecessary_wraps)
  • 123b4b3 [pedantic] refactor(clippy): make stateless helpers associated (clippy::unused_self)
  • 610dc0e [pedantic] style(clippy): elide response helper lifetimes (clippy::needless_lifetimes)
  • 042c637 [pedantic] style(clippy): build parameter examples in place (clippy::format_collect)
  • 1630cf9 [pedantic] chore(clippy): keep snapshot modules near test phases (clippy::items_after_statements)
  • 8cf53b2 [pedantic] docs(clippy): explain the ignored GitHub fixture (clippy::ignore_without_reason)
  • 30d37fd [pedantic] style(clippy): construct empty strings directly (clippy::manual_string_new)
  • 630a467 [nursery] style(clippy): split the client hook overview (clippy::too_long_first_doc_paragraph)
  • 79d5ce6 [nursery] style(clippy): align visibility with private modules (clippy::redundant_pub_crate)
  • ae50982 [nursery] style(clippy): refer to error variants through Self (clippy::use_self)
  • b92cce6 [nursery] style(clippy): express optional fallbacks directly (clippy::option_if_let_else)
  • 3d20ce4 [nursery] style(clippy): test simple enum variants directly (clippy::equatable_if_let)
  • 21cfe32 [nursery] style(clippy): check upgrade responses with any (clippy::search_is_some)
  • abeba68 [nursery] style(clippy): move converted array items directly (clippy::redundant_clone)
  • 7c223b0 [nursery] refactor(clippy): borrow helper receivers immutably (clippy::needless_pass_by_ref_mut)
  • 5658b15 [nursery] style(clippy): construct the single type implementation iterator (clippy::iter_on_single_items)
  • 4514647 [nursery] style(clippy): derive the JSON dependency flag from the branch (clippy::useless_let_if_seq)
  • 6dc453e [nursery] style(clippy): compare the wasm base URL directly (clippy::manual_assert_eq)
  • 2e100ed [nursery] style(clippy): consume the inert compile-check future (clippy::no_effect_underscore_binding)

Deferred typify follow-up

The forced generated-code audit found two pedantic diagnostics originating in typify output:

  • clippy::struct_field_names: schema-derived names such as Error::error_code, including corresponding typify builder fields.
  • clippy::default_trait_access: typify emits Default::default() where Clippy prefers a concrete type.

These are now isolated with exact, reasoned allowances on the generated types module while the existing clippy::all downstream compatibility boundary remains. They should be addressed in typify later rather than rewritten in progenitor after generation.

Existing allowance audit

  • Narrowed the client hook's unused suppression to unused_variables.
  • Retained async_fn_in_trait, generated unused_imports / unused_mut, fixture dead_code, and missing-doc boundaries where they reflect generated or deliberately compile-only code.
  • Added exact rationales for schema-shaped argument counts, explicit response ranges, public error size, conditional builder const eligibility, named stream lifetimes, and browser-local wasm futures.

Validation

Toolchain:

  • rustc 1.99.0-nightly (af3d95584 2026-07-09)
  • cargo 1.99.0-nightly (59800466c 2026-07-07)
  • clippy 0.1.98 (af3d95584d 2026-07-09)

Passed:

  • cargo +nightly fmt --all -- --check
  • cargo +nightly clippy --workspace --all-targets --all-features -- -W clippy::pedantic -W clippy::nursery -D warnings
  • cargo +nightly clippy -p example-wasm --target wasm32-unknown-unknown --all-targets --all-features -- -W clippy::pedantic -W clippy::nursery -D warnings
  • forced-warning audits for clippy::all, clippy::pedantic, and clippy::nursery
  • cargo +nightly test -p progenitor-impl --test test_output --test test_specific
  • cargo +nightly test -p cargo-progenitor --test test_cmd

The monolithic cargo +nightly test --workspace --all-targets --all-features run was also attempted. It found the stale CLI help fixture fixed above; its retry was stopped during linking when the local filesystem reached 100%. The package-scoped affected tests pass, and every workspace target compiles under the Clippy commands above.

@danieleades danieleades marked this pull request as ready for review December 19, 2025 14:38
@ahl

ahl commented Dec 26, 2025

Copy link
Copy Markdown
Collaborator

Thanks for your interest in contributing! We don't tend to find clippy-only fixes of much interest. The exception is if they pertain to generated code and the changes don't introduce disproportionate complexity. I'm also not sure what version of clippy you're using--I see a different set of nits in 1.92 for example.

@danieleades

Copy link
Copy Markdown
Author

Thanks for your interest in contributing! We don't tend to find clippy-only fixes of much interest. The exception is if they pertain to generated code and the changes don't introduce disproportionate complexity. I'm also not sure what version of clippy you're using--I see a different set of nits in 1.92 for example.

There are a few more valuable changes sprinkled through here (such as shadowing nightly method names and addressing deprecations). Would you like to see them in a separate PR?

More generally I think addressing clippy warnings (or explicitly suppressing lints you don't like) is valuable in it's own right, since all the "noise" from lower value lints obscures more valuable ones that have a genuine impact. That's a personal view, and I appreciate it may not be yours

@danieleades danieleades marked this pull request as draft July 12, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants