Update AST pretty printing

This commit is contained in:
CoCo-Japan-pan
2026-04-19 00:01:43 +09:00
parent 5d8a2977b1
commit a0b8e89456
6 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -3786,10 +3786,10 @@ pub struct TraitAlias {
#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
pub struct Trait {
pub impl_restriction: ImplRestriction,
pub constness: Const,
pub safety: Safety,
pub is_auto: IsAuto,
pub impl_restriction: ImplRestriction,
pub ident: Ident,
pub generics: Generics,
#[visitable(extra = BoundKind::SuperTraits)]
+1 -1
View File
@@ -543,10 +543,10 @@ fn lower_item_kind(
})
}
ItemKind::Trait(box Trait {
impl_restriction,
constness,
is_auto,
safety,
impl_restriction,
ident,
generics,
bounds,
@@ -371,10 +371,10 @@ pub(crate) fn print_item(&mut self, item: &ast::Item) {
self.bclose(item.span, empty, cb);
}
ast::ItemKind::Trait(box ast::Trait {
impl_restriction,
constness,
safety,
is_auto,
impl_restriction,
ident,
generics,
bounds,
@@ -382,10 +382,10 @@ pub(crate) fn print_item(&mut self, item: &ast::Item) {
}) => {
let (cb, ib) = self.head("");
self.print_visibility(&item.vis);
self.print_impl_restriction(impl_restriction);
self.print_constness(*constness);
self.print_safety(*safety);
self.print_is_auto(*is_auto);
self.print_impl_restriction(impl_restriction);
self.word_nbsp("trait");
self.print_ident(*ident);
self.print_generic_params(&generics.params);
+1 -1
View File
@@ -1157,10 +1157,10 @@ fn parse_item_trait(&mut self, attrs: &mut AttrVec, lo: Span) -> PResult<'a, Ite
generics.where_clause = self.parse_where_clause()?;
let items = self.parse_item_list(attrs, |p| p.parse_trait_item(ForceCollect::No))?;
Ok(ItemKind::Trait(Box::new(Trait {
impl_restriction,
constness,
is_auto,
safety,
impl_restriction,
ident,
generics,
bounds,
@@ -448,30 +448,30 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
},
(
Trait(box ast::Trait {
impl_restriction: liprt,
constness: lc,
is_auto: la,
safety: lu,
impl_restriction: liprt,
ident: li,
generics: lg,
bounds: lb,
items: lis,
}),
Trait(box ast::Trait {
impl_restriction: riprt,
constness: rc,
is_auto: ra,
safety: ru,
impl_restriction: riprt,
ident: ri,
generics: rg,
bounds: rb,
items: ris,
}),
) => {
matches!(lc, ast::Const::No) == matches!(rc, ast::Const::No)
eq_impl_restriction(liprt, riprt)
&& matches!(lc, ast::Const::No) == matches!(rc, ast::Const::No)
&& la == ra
&& matches!(lu, Safety::Default) == matches!(ru, Safety::Default)
&& eq_impl_restriction(liprt, riprt)
&& eq_id(*li, *ri)
&& eq_generics(lg, rg)
&& over(lb, rb, eq_generic_bound)
+1 -1
View File
@@ -1155,10 +1155,10 @@ pub(crate) fn format_trait(
offset: Indent,
) -> RewriteResult {
let ast::Trait {
ref impl_restriction,
constness,
is_auto,
safety,
ref impl_restriction,
ident,
ref generics,
ref bounds,