|
| 1 | +# PR #16093: Workflow Design Impact Analysis |
| 2 | + |
| 3 | +## Affected Workflows |
| 4 | +- **cargo-clippy** (Workflow 1): The PR changes code in `clippy_lints/src/` (lint implementation and registration), which is executed during Cargo project analysis via the clippy-driver wrapper. This impacts the diagnostics produced in the workflow's output. |
| 5 | + |
| 6 | +- **clippy-driver** (Workflow 2): Direct changes to lint passes registered by the driver, affecting individual file or non-Cargo linting. |
| 7 | + |
| 8 | +- **testing** (Workflow 4): Updates to multiple UI test files in `tests/ui/` for the `format_push_string` lint, including new tests for suggestion behavior under various configurations (no_std, unfixable cases) and updated expected outputs (`.stderr`, `.fixed`). |
| 9 | + |
| 10 | +- **lint-development** (Workflow 5): The PR is a direct instance of lint development, modifying an existing lint's logic to add suggestion support, updating manual registration in `lib.rs` to use stateful pass construction, and maintaining corresponding UI tests. |
| 11 | + |
| 12 | +## cargo-clippy Analysis |
| 13 | +### Summary of design changes |
| 14 | +Specific aspects affected: The registration and execution of lint passes in the compilation pipeline. The PR updates the constructor for `FormatPushString` pass to include `FormatArgsStorage`, enabling advanced detection of `format!` macro calls for generating targeted suggestions. This is implemented within `register_lint_passes` by cloning the shared storage into the pass. Potential benefits: Improved lint accuracy and user-friendly fixes, reducing unnecessary String allocations in formatted string concatenation. Implications: Enhanced diagnostic quality in project-wide linting runs. |
| 15 | + |
| 16 | +The design diagram's registration step has been updated to note internal resource initialization and stateful pass creation. |
| 17 | + |
| 18 | +```mermaid |
| 19 | +sequenceDiagram |
| 20 | + participant LS as "Lint Store" |
| 21 | + participant CL as "Clippy Lints" |
| 22 | + Note over LS,CL: Diff visualization |
| 23 | + Note over CL: Addition (green rect) |
| 24 | + CL->>CL: initialize FormatArgsStorage |
| 25 | + Note over LS: Change (yellow rect) |
| 26 | + LS->>CL: register_lint_passes |
| 27 | + CL-->>LS: register stateful passes (e.g., format_push_string with storage) |
| 28 | +``` |
| 29 | + (Green: new internal step; Yellow: modified pass registration to support state.) |
| 30 | + |
| 31 | +## clippy-driver Analysis |
| 32 | +### Summary of design changes |
| 33 | +Similar to cargo-clippy, the PR affects the lint pass registration in the driver's compiler callbacks. The updated pass can now provide suggestions during direct compilations. Implemented by the same code changes in clippy_lints. Benefits: Consistent improvements across invocation methods. The design diagram updated accordingly. |
| 34 | + |
| 35 | +```mermaid |
| 36 | +sequenceDiagram |
| 37 | + participant C as Compiler Config & Callbacks |
| 38 | + participant LS as Lint Store |
| 39 | + Note over C,LS: Existing |
| 40 | + C->>LS: register_lint_passes() |
| 41 | + Note over C,LS: After PR |
| 42 | + Note over LS: Change (yellow): adds stateful lints |
| 43 | + C->>LS: register_lint_passes() - with shared resources init |
| 44 | +``` |
| 45 | + (Yellow: updated description to include resource handling.) |
| 46 | + |
| 47 | +## testing Analysis |
| 48 | +### Summary of design changes |
| 49 | +The PR updates 11 test files to match the new diagnostic outputs, including addition of `.fixed` files for testing auto-fix applicability and new test cases for edge cases (e.g., no_std_unfixable). This validates the lint's new suggestion logic without changing the UI test execution flow or components. Implemented by updating expected `.stderr` with new messages, labels, notes, and fix results. Benefits: Ensures regression-free enhancements and full coverage of new features. No mermaid diagram updates needed, as the sequence remains the same. |
| 50 | + |
| 51 | +## lint-development Analysis |
| 52 | +### Summary of design changes |
| 53 | +The PR modifies the documented design by exemplifying and prompting documentation of stateful lint passes using shared `FormatArgsStorage` for macro analysis. Specific aspects: Lint implementation now includes state in pass struct for efficiency, registration manually passes cloned storage. New detection logic spans nested expressions via recursive search. Suggestions use `span_suggestion_verbose` with `Applicability::MaybeIncorrect` and dynamic paths via `std_or_core`. The design doc has been updated with a new bullet in "Lint Implementation Details" and enhanced integration diagram to show resource preparation and stateful extension. Benefits: Enables complex analysis patterns for lints, improves suggestion completeness for `format_push_string`. Implications: Developers can adopt this pattern for other macro-heavy lints. |
| 54 | + |
| 55 | +Updated mermaid diagram in doc shows additions/changes; diff visualization: |
| 56 | + |
| 57 | +```mermaid |
| 58 | +sequenceDiagram |
| 59 | + participant Driver |
| 60 | + participant LintsCrate |
| 61 | + participant Store |
| 62 | + Driver->>LintsCrate: call register_lint_passes on store |
| 63 | + Note over LintsCrate: Addition (green) |
| 64 | + LintsCrate->>LintsCrate: initialize FormatArgsStorage |
| 65 | + Note over Store: Change (yellow) |
| 66 | + LintsCrate->>Store: extend passes (with storage for some lints like format_push_string) |
| 67 | +``` |
| 68 | + (Green: new resource init step; Yellow: modified extension to include state passing.) |
| 69 | + |
| 70 | +The PR does not affect other workflows' designs significantly. |
0 commit comments