Skip to content

bindgen-cli generates mixed EOL if rustfmt is configured to use non-native style #3242

Open
@ZyX-II

Description

@ZyX-II

The following script run on Windows will generate file header.rs which has first four lines ending with CRLF and rest ending with LF:

cd %~dp0

echo int foo; > header.h
echo newline_style = "Unix" > fmt.toml

bindgen "header.h" ^
    -o header.rs ^
    --raw-line "pub use std;" ^
    --rustfmt-configuration-file %~dp0\fmt.toml

I assume this is because rustfmt configuration is not applied to raw-line (third line), bindgen own comment (first line) and empty lines separating comment from raw lines and raw lines from the rest of the file.

I also assume that on linux same problem can be reproduced if rustfmt was configured to use CRLF instead.

Bindgen version: 0.72.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions