Skip to main content

Module fix

Module fix 

Source
Expand description

Applying the fixes that diagnostics carry (htl fix).

The shape follows what cargo fix, ESLint and Ruff settled on: a fix travels with its diagnostic and has an applicability class; only safe applies unless asked; edits that overlap within one pass are deferred to the next, which re-checks the file; passes are capped; a fix that leaves the file with an error it did not have is reverted; everything applied is reported, not only what remains. A file the parser rejects is never touched; type errors do not block (their positions are sound, and a fix may be what removes them), the revert is the guard.

Structs§

Applied
One fix that was (or would be) applied.
FileOutcome
FixOptions
Skipped
One fix that was not applied, and why.

Constants§

MAX_PASSES
Passes per file before giving up (cargo fix uses 4).

Functions§

fix_file
Fix one file in place (or in memory with dry_run). The checker’s search path must already cover the project.
git_dirty
Is path clean in git? Ok(None) when it is not inside a repository.
unified_diff
A unified diff of before -> after (LCS on lines, 3 lines of context).