Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tools/rustfmt/src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,7 @@ fn format_impl_ref_and_type(

if let Some(of_trait) = of_trait.as_deref() {
result.push_str(format_defaultness(of_trait.defaultness));
result.push_str(format_constness(*constness));
result.push_str(format_safety(of_trait.safety));
} else {
result.push_str(format_constness(*constness));
Expand All @@ -980,7 +981,6 @@ fn format_impl_ref_and_type(

let trait_ref_overhead;
if let Some(of_trait) = of_trait.as_deref() {
result.push_str(format_constness_right(*constness));
let polarity_str = match of_trait.polarity {
ast::ImplPolarity::Negative(_) => "!",
ast::ImplPolarity::Positive => "",
Expand Down
8 changes: 0 additions & 8 deletions src/tools/rustfmt/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,6 @@ pub(crate) fn format_constness(constness: ast::Const) -> &'static str {
}
}

#[inline]
pub(crate) fn format_constness_right(constness: ast::Const) -> &'static str {
match constness {
ast::Const::Yes(..) => " const",
ast::Const::No => "",
}
}

#[inline]
pub(crate) fn format_defaultness(defaultness: ast::Defaultness) -> &'static str {
match defaultness {
Expand Down
14 changes: 0 additions & 14 deletions src/tools/rustfmt/tests/source/const_trait.rs

This file was deleted.

5 changes: 1 addition & 4 deletions src/tools/rustfmt/tests/target/const_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ const trait Bar {}

const trait Foo = Bar;

impl const Bar for () {}

// const impl gets reformatted to impl const.. for now
impl const Bar for u8 {}
const impl Bar for () {}

struct X;

Expand Down
2 changes: 1 addition & 1 deletion src/tools/rustfmt/tests/target/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ where
}

// #4084
impl const std::default::Default for Struct {
const impl std::default::Default for Struct {
#[inline]
fn default() -> Self {
Self { f: 12.5 }
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rustfmt/tests/target/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const fn not_quite_const<S: [const] T>() -> i32 {
<S as T>::CONST
}

impl const T for U {}
const impl T for U {}

fn apit(_: impl [const] T) {}

Expand Down
Loading