3 ms·
Do you know if there are plans for rustfmt to auto-import like gofmt does? In the sense that if a crate is available (in the .toml file) and you reference it, r
by greenhouse_gas 9y ago
Do you know if there are plans for rustfmt to auto-import like gofmt does? In the sense that if a crate is available (in the .toml file) and you reference it, rustfmt will automatically insert the required "import" and "use".
- steveklabnik 9y agoThere's been talk of it, but it hasn't been built yet. It's more likely to be a part of RLS than rustfmt.
- killercup 9y agoIf the compiler gives you an error with a suggestion "You probably need to add `extern crate foo;`" (and it already does in some cases), RLS (i.e., your editor plugin) will be able to automatically add it for you (soon™).
- Manishearth 9y agoThis would probably be an RLS thing. There's a separate tool called rustfix in development that can apply the suggestions given by the compiler, so it could theoretically prompt for these.