Rustfmt: `width_heuristics` item not being parsed

Created on 10 May 2020  路  1Comment  路  Source: rust-lang/rustfmt

I have a rustfmt.toml like so:

width_heuristics = "Max"

And when I run rustfmt, I get the following error

Error: Decoding config file failed:
invalid type: string "Max", expected struct WidthHeuristics for key `width_heuristics`
Please check your config file.

Version rustfmt 1.4.14-nightly (a5cb5d2 2020-04-14)

Most helpful comment

Apologies for the confusion @chrisvittal.

Since you are using the released rustfmt 1.4.14 version, you'll need to use the use_small_heuristics config option.

As part of the upcoming rustfmt 2.0 release we're refactoring the width heuristics configuration options to give users more granular control, and the latest Configuration documentation (https://github.com/rust-lang/rustfmt/blob/master/Configurations.md and http://rust-lang.github.io/rustfmt/) is reflective of those rustfmt 2.0 changes.

rustfmt 2.0 (and new/updated config opts like width_heuristics) are currently only available when building rustfmt from source.

>All comments

Apologies for the confusion @chrisvittal.

Since you are using the released rustfmt 1.4.14 version, you'll need to use the use_small_heuristics config option.

As part of the upcoming rustfmt 2.0 release we're refactoring the width heuristics configuration options to give users more granular control, and the latest Configuration documentation (https://github.com/rust-lang/rustfmt/blob/master/Configurations.md and http://rust-lang.github.io/rustfmt/) is reflective of those rustfmt 2.0 changes.

rustfmt 2.0 (and new/updated config opts like width_heuristics) are currently only available when building rustfmt from source.

Was this page helpful?
0 / 5 - 0 ratings