-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Description
Unless I am missing something, there isn't a super nice way to use rustfmt
programmatically—
For example, I have a project where I am generating some repetitive Rust code with syn
and quote
in build.rs
. The output is missing newlines, etc., so it is desirable to run the code through rustfmt
.
Currently I am writing the generated string to a file and then using rustfmt::format_input
to format and overwrite that file. This works, and is really not so bad, I was mostly just surprised to find that there was no function like fn(config: Config, input: &str) -> String
.
Is there some reason not to support this simple case? Or am I missing something?