Search code examples
rustformattingtomlrustfmt

Unknown configuration option `group_imports` for rustfmt


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

Solution

  • 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.