Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .exp/design-workflow-5-lint-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Other aspects: Lints support configuration options, MSRV restrictions via attrib

## Scaffolding Sequence Diagram

\`\`\`mermaid
```mermaid
sequenceDiagram
participant Developer
participant "cargo dev new_lint" as NewLintTool
Expand All @@ -42,11 +42,11 @@ sequenceDiagram
UpdateTool->>LibRs: Update mod declarations between comments
UpdateTool->>README: Update lint counts and links
Note over UpdateTool: Handles deprecated and renamed lints too
\`\`\`
```

## Integration and Execution Sequence Diagram

\`\`\`mermaid
```mermaid
sequenceDiagram
participant User
participant "cargo clippy" as CargoClippy
Expand All @@ -62,7 +62,7 @@ sequenceDiagram
Driver->>Compiler: run compilation with registered lints
Store->>Compiler: execute lint passes during compilation phases
Compiler->>User: output diagnostics from lints
\`\`\`
```

## Additional High-Level Design Aspects

Expand Down
48 changes: 48 additions & 0 deletions pr-analysis-16117.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# PR #16117: Workflow Design Impact Analysis

## Affected Workflows
- **cargo-clippy**: Modified file `clippy_lints/src/multiple_unsafe_ops_per_block.rs` is listed in relevant_files for this workflow. The change affects lint diagnostics produced during `cargo clippy` runs.
- **clippy-driver**: Similarly impacts direct invocations of the Clippy driver via changes to lint logic in `clippy_lints/src/`.
- **testing**: Updates to `tests/ui/multiple_unsafe_ops_per_block.rs` and `.stderr` directly involve the UI testing infrastructure.
- **lint-development**: The PR demonstrates modification of an existing lint in `clippy_lints/src/` and corresponding UI test updates, aligning with this workflow's purpose and relevant files.

## cargo-clippy Analysis
### Summary of design changes
The PR fixes the `multiple_unsafe_ops_per_block` lint to count unsafe operations and macro calls only towards the innermost `unsafe` block, addressing [issue #16116](https://github.com/rust-lang/rust-clippy/issues/16116). This improves lint accuracy for nested unsafe code and macro expansions containing unsafe code.

This affects the internal implementation within the Clippy lints crate, altering diagnostic emission for specific code patterns during the lint execution phase. However, it does not modify workflow components, sequences, or flows documented in `.exp/design-workflow-1-cargo-clippy.md`. No new steps are added, and interactions remain the same.

**Potential benefits**: Reduces false positives in linting nested unsafe blocks, promoting better unsafe code organization and documentation.

No Mermaid diagrams require updates.

## clippy-driver Analysis
### Summary of design changes
Similar to cargo-clippy, the PR changes lint behavior in direct driver usage scenarios, refining how `multiple_unsafe_ops_per_block` operates on unsafe code structures. Documented in `.exp/design-workflow-2-clippy-driver.md`, the high-level design of driver invocation, lint registration, and execution is unaffected; only one lint's pass logic is enhanced.

**Potential implications**: Ensures consistent linting behavior across invocation methods (Cargo vs. direct).

No Mermaid diagrams require updates.

## testing Analysis
### Summary of design changes
The PR updates the UI test input and expected output (`.stderr`) for `multiple_unsafe_ops_per_block` to match the new lint logic, as part of validating the fix. This follows the standard UI testing process in `.exp/design-workflow-4-testing.md` without altering test compilation, execution, or validation steps.

**Potential benefits**: Maintains test coverage for the refined lint behavior, preventing regressions.

No Mermaid diagrams require updates.

## lint-development Analysis
### Summary of design changes
This PR exemplifies the lint-development workflow by modifying an existing LateLintPass implementation in `clippy_lints/src/multiple_unsafe_ops_per_block.rs` (adding logic to skip inner unsafe blocks and handle macro calls uniquely) and updating lint metadata (description notes) and UI tests. Per `.exp/design-workflow-5-lint-development.md`, this aligns with implementing lint passes and testing but introduces no changes to scaffolding, registration (via `update_lints`), or integration sequences.

The updated lint logic uses existing visitor patterns and compiler APIs without new components or steps.

**Potential benefits**: Provides a model for future lint refinements, especially for handling expansions and nesting.

No Mermaid diagrams require updates.

## Overall Conclusion
The PR primarily impacts lint execution behavior in running Clippy (workflows 1 & 2) and validation processes (4 & 5) through a targeted fix in one lint. No structural changes to workflow designs necessitate updates to `.exp/` documentation or Mermaid diagrams. The change enhances lint precision without altering high-level architectures.

[PR #16117](https://github.com/rust-lang/rust-clippy/pull/16117)