Skip to content

Cannot set granular width configuration settings to 100% if max_width = 100  #5404

@tcharding

Description

@tcharding

Thanks for your work on rustfmt!

The granular width configuration settings are documented to be percentages of max_width (e.g. chain_width). However when max_width is set to 100 setting their values to 100 causes a warning

`fn_call_width` cannot have a value that exceeds `max_width`. `fn_call_width` will be set to the same value as `max_width`

The error message is both surprising and incorrect since fn_call_width = 100 is not a value that exceeds max_width.

This does not happen if max_width is 99 or 101.

The exact config options that trigger this bug are:

max_width = 100
use_small_heuristics = "Off"
fn_call_width = 100
$ rustfmt --version
rustfmt 1.4.38-stable (fe5b13d 2022-05-18)

Edit by @ytmimi (add a minimal reproducible code snippet):
macro_rules! foo {
    () => {};
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions