Skip to content

Bug: rustfmt complains that fn_call_width is bigger than max_width when it isn't #6074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bergkvist opened this issue Feb 15, 2024 · 3 comments

Comments

@bergkvist
Copy link

bergkvist commented Feb 15, 2024

When running cargo fmt, I get the following warning message printed out to my terminal:

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

rust version 1.78.0-nightly (ee9c7c940 2024-02-14)

The following macro somehow triggers the warning:

mod a {
    macro_rules! b {
        () => {};
    }
}

When you have a .rustfmt.toml config set up file like this:

max_width = 100
fn_call_width = 90

Increasing max_width to 102, or changing the macro to the following will make the warning go away:

mod a {
    macro_rules! b {
        () => {{}};
    }
}

See this repo for how to reproduce:
https://github.com/bergkvist/rustfmt-bug

@bergkvist
Copy link
Author

Seems like this might be caused by the following:

// max_width here is 100
// fn_call_width here is 90
mod a {
    // max_width here is 96
    // fn_call_width here is 90
    macro_rules! b {
        () => {
            // max_width here is 88
            // fn_call_width here is 90
        };
    }
}

@bergkvist
Copy link
Author

This seems like it is caused by the same problem as #5404.

@ytmimi
Copy link
Contributor

ytmimi commented Feb 16, 2024

Thanks for the report! Right, this is likely a duplicate of #5404 so I'm going to close this one.

@ytmimi ytmimi closed this as not planned Won't fix, can't repro, duplicate, stale Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants