Skip to content

cargo add, etc do not preserve \r\n line endings #14863

Open
@epage

Description

@epage

Problem

Generally people want line endings to be consistent. When Cargo modifies a Cargo.toml, it may insert \n independent of what line ending type is used

Steps

  1. Have a Cargo.toml file with \r\n line endings
  2. Run cargo add serde
  3. See that \n line endings are mixed in

Possible Solution(s)

Check if \r\n is present and then convert any stray \ns to \r\n

Notes

See also #14857 as cargo-script has another area where this can be hit

Version


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions