Open
Description
If I ask cargo fmt
from 1.81.0 to format this code, I get:
const COUNT: u8 = 5;
pub struct Thing;
impl Thing {
pub fn set() {
#[allow(clippy::assertions_on_constants)]
const {
assert!(COUNT == 5)
};
}
}
Under 1.80.0 I get:
const COUNT: u8 = 5;
pub struct Thing;
impl Thing {
pub fn set() {
#[allow(clippy::assertions_on_constants)]
const { assert!(COUNT == 5) };
}
}
Weirdly, if I remove the lint attribute, then both 1.81.0 and 1.80.0 format the const block on a single line.
I'm on Ubuntu 22.04, with no rustfmt.toml
and the rustfmt
versions are:
$ .rustup/toolchains/1.80.0-x86_64-unknown-linux-gnu/bin/rustfmt -V
rustfmt 1.7.0-stable (0514789 2024-07-21)
$ .rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/bin/rustfmt -V
rustfmt 1.7.1-stable (eeb90cd 2024-09-04)
Metadata
Metadata
Assignees
Labels
No labels