Skip to content

cargo fix applies fixes multiple times on files imported multiple times #57171

Closed
@Marwes

Description

@Marwes

cargo fix appears to try and apply its fixes multiple times if a file is used multiple times. This can be a problem when using "support" modules for tests as cargo fix can end up calculating the locations for the fixes on the original file for two test, apply them for the first test and then apply them for the second test, only the file has now changed and the fix gets applied in the wrong location. (At least that is what appears to happen).

tests/
    a.rs
    b.rs
    support/mod.rs # Used by a.rs and b.rs

Workaround is to specify --jobs 1 when running cargo fix

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-cargoRelevant to the cargo team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions