rust-lang / rust-lang/rustfmt

--print-config current with use_small_heuristics = "Off": Could not output config: out-of-range value for u64 type

Open
#6,364 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-cli C-bug SO-print-config SO-use_small_heuristics
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

I'm attempting to detect whether a project has unstable rustfmt features configured, and was hoping to use rustfmt to detect that. However, with a config file like:

edition = "2021"

condense_wildcard_suffixes = true
error_on_line_overflow = true
format_code_in_doc_comments = true
format_macro_bodies = true
format_macro_matchers = true
format_strings = true
group_imports = "StdExternalCrate"
hex_literal_case = "Upper"
imports_granularity = "Crate"
max_width = 80
newline_style = "Unix"
reorder_impl_items = true
use_field_init_shorthand = true
use_small_heuristics = "Off"
use_try_shorthand = true
wrap_comments = true

running the following only prints an error:

:;    rustfmt +nightly --print-config current main.rs
Could not output config: out-of-range value for u64 type

I would expect that config file to re-serialize correctly, as the formatter does do the work according to the config.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with rustfmt +nightly --print-config current main.rs and the shown configuration, focusing on use_small_heuristics = "Off". Trace the --print-config entry point and its config serialization path. Done means the command outputs the configuration without the out-of-range u64 error and preserves the configured value.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.