Skip to content

STYLE: Complete the declare-then-assign sweep beyond #6014's 42 files #6751

Description

@hjmjohnson

#6014 converted declare-then-assign to initialization-at-declaration across 42 files. A follow-up scan indicates the sweep is incomplete, but the residual count needs restating with an explicit predicate before the work is scoped.

Count — and why the previously circulated number is wrong

A local note carried an estimate of "~65 more candidates". That figure is
unsupported and should not be used. Re-scanning during a 2026-07-29 audit
produced substantially fewer:

Predicate Sites
Strict adjacency (declaration immediately followed by assignment) 21
Relaxed (skipping intervening comments; wider type set) 31

These were derived by an automated pass and have not been independently
reproduced. The first work item is therefore to fix the predicate and publish
it, so the number is re-derivable the way #6388's scanner is.

Proposed work
  1. State the exact predicate (which types, what counts as "adjacent",
    whether comments/blank lines break the pair) and publish the scanner
    alongside the count.
  2. Convert the sites the predicate selects, respecting the hazard in the
    companion documentation issue: T x = expr; is construction, not
    assignment, so tests that deliberately exercise operator= must keep the
    two-line form.
  3. Skip any site where the variable is later mutated, or use the explicit-type
    form rather than auto.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:StyleStyle changes: no logic impact (indentation, comments, naming)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions