Skip to content

Commit 107c3f4

Browse files
committed
fix rustfmt on const impl Ty {}
1 parent 8d405cc commit 107c3f4

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

src/items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ fn format_impl_ref_and_type(
971971
result.push_str(format_defaultness(of_trait.defaultness));
972972
result.push_str(format_safety(of_trait.safety));
973973
} else {
974-
result.push_str(format_constness_right(*constness));
974+
result.push_str(format_constness(*constness));
975975
}
976976

977977
let shape = if context.config.style_edition() >= StyleEdition::Edition2024 {

tests/source/const_trait.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![feature(trait_alias, const_trait_impl)]
2+
3+
const trait Bar {}
4+
5+
const trait Foo = Bar;
6+
7+
impl const Bar for () {}
8+
9+
// const impl gets reformatted to impl const.. for now
10+
const impl Bar for u8 {}
11+
12+
struct X;
13+
14+
const impl X {}

tests/target/const_trait.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,12 @@
33
const trait Bar {}
44

55
const trait Foo = Bar;
6+
7+
impl const Bar for () {}
8+
9+
// const impl gets reformatted to impl const.. for now
10+
impl const Bar for u8 {}
11+
12+
struct X;
13+
14+
const impl X {}

0 commit comments

Comments
 (0)