Skip to content

--rustfmt_bindings doesn't work with printing bindings to stdout #968

@fitzgen

Description

@fitzgen

This produces pretty code in output.rs:

$ bindgen input.h --rustfmt-bindings -o output.rs

This does not print pretty code to stdout:

$ bindgen input.h --rustfmt-bindings

See the rustfmt_generated_file function in src/lib.rs for where we currently run rustfmt on generated files. We need to have a version of this for when we are printing to stdout that writes the unformatted bindings to a child rustfmt's stdin, and then pipes the child's stdout to our stdout. We actually have something pretty similar to this in tests/tests.rs as well in the rustfmt function there.

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