2

I have a rustfmt.toml file with the line group_imports = "StdExternalCrate" in it, which according to the documentation should be a valid option. However, I get the following warning:

Warning: Unknown configuration option `group_imports`

Running rustfmt on a test file didn't seem to group the imports as specified either. I've updated everything today with rustup update and currently have version "rustfmt 1.4.27-nightly", which seems to be the latest stable minor version.

I've also made sure to enable unstable features with unstable_features = true, as per documentation. Why can't I use this option? Is it because I'm using nightly? How would I go about enabling this option in that case?

Full rustfmt.toml file for reference:

edition = "2018"
unstable_features = true

format_code_in_doc_comments = true

brace_style = "AlwaysNextLine"
control_brace_style = "AlwaysNextLine"

fn_single_line = true
where_single_line = true

blank_lines_upper_bound = 2
inline_attribute_width = 32

reorder_impl_items = true
group_imports = "StdExternalCrate"

enum_discrim_align_threshold = 16
struct_field_align_threshold = 16
Ted Klein Bergman
  • 9,146
  • 4
  • 29
  • 50
  • Uhm, looks like the [documentation](https://rust-lang.github.io/rustfmt/?version=master&search=#group_imports) pointing to master, so I guess you would need version `2.0.0` of rustfmt for using that. – Netwave Dec 04 '20 at 13:37
  • @Netwave You seem to be correct. Inserting the version number in the link (https://rust-lang.github.io/rustfmt/?version=1.4.27&search=#group_imports) seem to confirm it's not in that version. A bit weird that the documentation and master branch is referencing unreleased code while the pulled crate is on version 1.4.27. And the option doesn't seem to be mentioned in the [changelog](https://github.com/rust-lang/rustfmt/blob/master/CHANGELOG.md#200-unreleased). – Ted Klein Bergman Dec 04 '20 at 14:59

1 Answers1

0

The option simply wasn't available in the version pulled from the crate. The documentation pointed to a later (at the time) unreleased code. The option is available in version 2.0.0, according to the documentation.

Ted Klein Bergman
  • 9,146
  • 4
  • 29
  • 50