Skip to content

Sixteen new lints for values that lean on convention instead of a type - #12

Merged
alii merged 34 commits into
masterfrom
ali/new-rules
Aug 15, 2026
Merged

alii merged 34 commits into
masterfrom
ali/new-rules

Conversation

@alii

@alii alii commented Aug 15, 2026

Copy link
Copy Markdown
Member

Adds sixteen lints, all built on the shared modules from #11 (plus one new one, hir_clone, for comparing the shape of two bodies). Fifteen are on by default; parallel_params is opt-in like flag_cluster because most of what it names is a judgement call. Each has a ui fixture with positives and must-not-fire cases, a README row, and passes over mordant's own source, which meant hir_shapes::field_chain and self_field now return small structs instead of tuples (unnamed_tuple was right about them).

By theme. Duplication: same_match_twice (the same match on the same enum written in two places), reimplemented_helper (a private fn whose body is another fn's body). State that should be a type: bool_beside_option, dependent_field, parallel_vecs, parallel_params, stringly_state, unnamed_tuple. Values whose kind lives only in a name or a position: bool_params, misbound_arg, crossed_alias (integer type aliases used interchangeably), crossed_index, sentinel_int. Checks that don't always run: collapsed_error (a Result turned into a bare bool/None and then dropped), uneven_narrowing (the same place narrowed checked here and with as there), bypassed_conversion (a transmute or pointer cast into a type that has a From/TryFrom for exactly that source).

The commit series is one lint per "add" commit followed by the refinements that quietened it; every refinement is structural (what the lint reads), none is a name list or a threshold bump. cargo test, clippy, fmt and the self-lint step are green at every commit I checked and at the head.

alii added 30 commits August 14, 2026 19:59
@alii
alii merged commit 4efc663 into master Aug 15, 2026
2 checks passed
alii added a commit to oven-sh/bun that referenced this pull request Aug 15, 2026
#38846)

Moves the pinned mordant revision to 4efc663, which adds sixteen lints
(duplicated matches and helpers, parallel vecs, bool parameter runs,
integer aliases used interchangeably, a Result collapsed to a bool and
dropped, the same place narrowed two ways, and a few more;
scarletindustries/mordant#12 has the list).
mordant-baseline.toml is regenerated against main so the job stays
advisory and only reports instances a change adds; the recorded counts
are what exists today (largest: 81 same_match_twice, 38 collapsed_error,
20 bool_params). #38841 already removes a good share of the
same_match_twice and reimplemented_helper entries and can shrink the
file when it lands.

Nothing else changes: same nightly, same dylint version, so the
workflow's caches key over on the rev alone.
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.

1 participant