]> git.lizzy.rs Git - rust.git/commitdiff
Always put a space after impl in macro pretty-printing
authorJonas Platte <jplatte+git@posteo.de>
Thu, 6 Jan 2022 10:08:32 +0000 (11:08 +0100)
committerJonas Platte <jplatte+git@posteo.de>
Thu, 6 Jan 2022 10:33:08 +0000 (11:33 +0100)
… regardless of whether the next symbol is punctuation or not.

crates/ide/src/expand_macro.rs
crates/ide_db/src/helpers/insert_whitespace_into_node.rs

index 949744c01b2ae73a79c342bea85f5cb9834776b5..69d2454cf7cc7ac31738f48111c9eff6710c396a 100644 (file)
@@ -319,7 +319,7 @@ struct Foo {}
 "#,
             expect![[r#"
                 Clone
-                impl< >core::clone::Clone for Foo< >{}
+                impl < >core::clone::Clone for Foo< >{}
 
             "#]],
         );
@@ -337,7 +337,7 @@ struct Foo {}
 "#,
             expect![[r#"
                 Copy
-                impl< >core::marker::Copy for Foo< >{}
+                impl < >core::marker::Copy for Foo< >{}
 
             "#]],
         );
@@ -354,9 +354,9 @@ struct Foo {}
 "#,
             expect![[r#"
                 Copy, Clone
-                impl< >core::marker::Copy for Foo< >{}
+                impl < >core::marker::Copy for Foo< >{}
 
-                impl< >core::clone::Clone for Foo< >{}
+                impl < >core::clone::Clone for Foo< >{}
 
             "#]],
         );
index 9d31966cea67a4926453fc7d55cbdcb8e6f61759..d59f13b9a1c8e2d785331a586a784f4b6f7ceb99 100644 (file)
@@ -88,7 +88,7 @@ pub fn insert_ws_into(syn: SyntaxNode) -> SyntaxNode {
             LIFETIME_IDENT if is_next(|it| is_text(it), true) => {
                 mods.push(do_ws(after, tok));
             }
-            AS_KW | DYN_KW => {
+            AS_KW | DYN_KW | IMPL_KW => {
                 mods.push(do_ws(after, tok));
             }
             T![;] => {