From 408ae4d5ed2849ae0a511336bb884771051970aa Mon Sep 17 00:00:00 2001 From: Shohei Wada Date: Thu, 5 Jan 2023 03:15:31 +0900 Subject: [PATCH 1/3] Fix the type alias's `where` clause position according to the updated rust syntax (see rust issue #89122) --- src/item.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/item.rs b/src/item.rs index 9454e15..7c13af6 100644 --- a/src/item.rs +++ b/src/item.rs @@ -307,12 +307,12 @@ impl Printer { self.word("type "); self.ident(&item.ident); self.generics(&item.generics); - self.where_clause_oneline(&item.generics.where_clause); self.word("= "); self.neverbreak(); self.ibox(-INDENT); self.ty(&item.ty); self.end(); + self.where_clause_oneline(&item.generics.where_clause); self.word(";"); self.end(); self.hardbreak(); @@ -728,12 +728,12 @@ impl Printer { self.word("type "); self.ident(&impl_item.ident); self.generics(&impl_item.generics); - self.where_clause_oneline(&impl_item.generics.where_clause); self.word("= "); self.neverbreak(); self.ibox(-INDENT); self.ty(&impl_item.ty); self.end(); + self.where_clause_oneline(&impl_item.generics.where_clause); self.word(";"); self.end(); self.hardbreak(); From efa202add73d32d73eb91ce5f49dc36a5008b9f9 Mon Sep 17 00:00:00 2001 From: Shohei Wada Date: Thu, 5 Jan 2023 03:24:02 +0900 Subject: [PATCH 2/3] little more formatting --- src/item.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/item.rs b/src/item.rs index 7c13af6..fb65a79 100644 --- a/src/item.rs +++ b/src/item.rs @@ -307,13 +307,12 @@ impl Printer { self.word("type "); self.ident(&item.ident); self.generics(&item.generics); - self.word("= "); + self.word(" = "); self.neverbreak(); self.ibox(-INDENT); self.ty(&item.ty); self.end(); - self.where_clause_oneline(&item.generics.where_clause); - self.word(";"); + self.where_clause_oneline_semi(&item.generics.where_clause); self.end(); self.hardbreak(); } @@ -631,10 +630,10 @@ impl Printer { self.type_param_bound(&bound); } if let Some((_eq_token, default)) = &trait_item.default { - self.where_clause_oneline(&trait_item.generics.where_clause); - self.word("= "); + self.word(" = "); self.neverbreak(); self.ty(default); + self.where_clause_oneline_semi(&trait_item.generics.where_clause); } else { self.where_clause_oneline_semi(&trait_item.generics.where_clause); } @@ -728,13 +727,12 @@ impl Printer { self.word("type "); self.ident(&impl_item.ident); self.generics(&impl_item.generics); - self.word("= "); + self.word(" = "); self.neverbreak(); self.ibox(-INDENT); self.ty(&impl_item.ty); self.end(); - self.where_clause_oneline(&impl_item.generics.where_clause); - self.word(";"); + self.where_clause_oneline_semi(&impl_item.generics.where_clause); self.end(); self.hardbreak(); } From c1709d0e23bf4d253463aae39f34f052db9d565d Mon Sep 17 00:00:00 2001 From: Shohei Wada Date: Thu, 5 Jan 2023 17:09:14 +0900 Subject: [PATCH 3/3] Reflecting the review comments. --- src/item.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/item.rs b/src/item.rs index fb65a79..62252f1 100644 --- a/src/item.rs +++ b/src/item.rs @@ -307,12 +307,13 @@ impl Printer { self.word("type "); self.ident(&item.ident); self.generics(&item.generics); - self.word(" = "); + self.where_clause_oneline(&item.generics.where_clause); + self.word("= "); self.neverbreak(); self.ibox(-INDENT); self.ty(&item.ty); self.end(); - self.where_clause_oneline_semi(&item.generics.where_clause); + self.word(";"); self.end(); self.hardbreak(); } @@ -633,10 +634,8 @@ impl Printer { self.word(" = "); self.neverbreak(); self.ty(default); - self.where_clause_oneline_semi(&trait_item.generics.where_clause); - } else { - self.where_clause_oneline_semi(&trait_item.generics.where_clause); } + self.where_clause_oneline_semi(&trait_item.generics.where_clause); self.end(); self.hardbreak(); }