`rustfmt::skip` sometimes ignored when using `error_on_line_overflow` and `error_on_unformatted`
Open
@matthewhughes934 is already working on this.
Since Aug 14, 2026.
C-feature-request
UO-error_on_line_overflow
UO-error_on_unformatted
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Summary
I tried to format this code:
impl Blah {
#[rustfmt::skip]
fn foo() {
{
{
select! {
_ = bar() => {
info!(
"WebAuthn challenge cache cleanup: __ registration, __ login, __ 2FA, __ email-change entries remaining",
);
},
}
}
}
}
}
(I tried to make it as small as possible without making the error go away)
Expected behavior
I expected to see this happen: Since I have rustfmt::skip, rustfmt should not concern itself with this function.
Actual behavior
Instead, this happened:
❯ rustup run nightly -- rustfmt foo.rs
error[internal]: line formatted, but exceeded maximum width (maximum: 100 (see `max_width` option), found: 133)
--> /home/alex/Documents/Projects/foo.rs:9:9:101
|
9 | ... "WebAuthn challenge cache cleanup: __ registration, __ login, __ 2FA, __ email-change entries remaining",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: set `error_on_unformatted = false` to suppress the warning against comments or string literals
Configuration
rustfmt configuration file (e.g. rustfmt.toml, if applicable):
edition = "2024"
error_on_line_overflow = true
error_on_unformatted = true
Reproduction Steps
Run rustfmt on the code above with the configuration above.
Meta
rustfmt --version:
rustfmt 1.9.0-nightly (bd08c9e718 2026-06-25)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.