about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2024-08-27 14:23:23 +0200
committerLukas Wirth <lukastw97@gmail.com>2024-08-27 14:23:23 +0200
commitc9a3b022818fb61b7af1e2bcdb6b707ea9f6df6f (patch)
tree0f8631d822cb42033ae2564d8c41a071b5c10730
parent662f02fc9bbd996a001779d5ec1b31a495944049 (diff)
downloadrust-c9a3b022818fb61b7af1e2bcdb6b707ea9f6df6f.tar.gz
rust-c9a3b022818fb61b7af1e2bcdb6b707ea9f6df6f.zip
Fix tests
-rw-r--r--src/tools/rust-analyzer/crates/ide-assists/src/handlers/toggle_macro_delimiter.rs42
-rw-r--r--src/tools/rust-analyzer/crates/ide-assists/src/tests/generated.rs4
2 files changed, 23 insertions, 23 deletions
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/toggle_macro_delimiter.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/toggle_macro_delimiter.rs
index 6fa5ff761f6..eedb2ea3b9a 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/toggle_macro_delimiter.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/toggle_macro_delimiter.rs
@@ -15,7 +15,7 @@ use crate::{AssistContext, Assists};
 //     () => {};
 // }
 //
-// sth! $0( );
+// sth!$0( );
 // ```
 // ->
 // ```
@@ -23,7 +23,7 @@ use crate::{AssistContext, Assists};
 //     () => {};
 // }
 //
-// sth! { }
+// sth!{ }
 // ```
 pub(crate) fn toggle_macro_delimiter(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<()> {
     #[derive(Debug)]
@@ -36,7 +36,7 @@ pub(crate) fn toggle_macro_delimiter(acc: &mut Assists, ctx: &AssistContext<'_>)
         RCur,
     }
 
-    let makro = ctx.find_node_at_offset_with_descend::<ast::MacroCall>()?.clone_for_update();
+    let makro = ctx.find_node_at_offset::<ast::MacroCall>()?.clone_for_update();
     let makro_text_range = makro.syntax().text_range();
 
     let cursor_offset = ctx.offset();
@@ -62,7 +62,7 @@ pub(crate) fn toggle_macro_delimiter(acc: &mut Assists, ctx: &AssistContext<'_>)
     };
 
     acc.add(
-        AssistId("add_braces", AssistKind::Refactor),
+        AssistId("toggle_macro_delimiter", AssistKind::Refactor),
         match token {
             MacroDelims::LPar => "Replace delimiters with braces",
             MacroDelims::RPar => "Replace delimiters with braces",
@@ -110,20 +110,20 @@ macro_rules! sth {
     () => {};
 }
 
-sth! $0( );
+sth!$0( );
             "#,
             r#"
 macro_rules! sth {
     () => {};
 }
 
-sth! { }
+sth!{ }
             "#,
         )
     }
 
     #[test]
-    fn test_braclets() {
+    fn test_braces() {
         check_assist(
             toggle_macro_delimiter,
             r#"
@@ -131,14 +131,14 @@ macro_rules! sth {
     () => {};
 }
 
-sth! $0{ };
+sth!$0{ };
             "#,
             r#"
 macro_rules! sth {
     () => {};
 }
 
-sth! [ ];
+sth![ ];
             "#,
         )
     }
@@ -152,14 +152,14 @@ macro_rules! sth {
     () => {};
 }
 
-sth! $0[ ];
+sth!$0[ ];
             "#,
             r#"
 macro_rules! sth {
     () => {};
 }
 
-sth! ( );
+sth!( );
             "#,
         )
     }
@@ -174,7 +174,7 @@ mod abc {
         () => {};
     }
 
-    sth! $0{ };
+    sth!$0{ };
 }
             "#,
             r#"
@@ -183,7 +183,7 @@ mod abc {
         () => {};
     }
 
-    sth! [ ];
+    sth![ ];
 }
             "#,
         )
@@ -196,7 +196,7 @@ mod abc {
             r#"
 macro_rules! prt {
     ($e:expr) => {{
-        println!("{}", stringify! {$e});
+        println!("{}", stringify!{$e});
     }};
 }
 
@@ -213,20 +213,20 @@ prt!(($03 + 5));
             r#"
 macro_rules! prt {
     ($e:expr) => {{
-        println!("{}", stringify! {$e});
+        println!("{}", stringify!{$e});
     }};
 }
 
-prt! $0((3 + 5));
+prt!$0((3 + 5));
 "#,
             r#"
 macro_rules! prt {
     ($e:expr) => {{
-        println!("{}", stringify! {$e});
+        println!("{}", stringify!{$e});
     }};
 }
 
-prt! {(3 + 5)}
+prt!{(3 + 5)}
 "#,
         )
     }
@@ -239,17 +239,17 @@ prt! {(3 + 5)}
             r#"
 macro_rules! prt {
     ($e:expr) => {{
-        println!("{}", stringify! {$e});
+        println!("{}", stringify!{$e});
     }};
 }
 
 macro_rules! abc {
     ($e:expr) => {{
-        println!("{}", stringify! {$e});
+        println!("{}", stringify!{$e});
     }};
 }
 
-prt! {abc!($03 + 5)};
+prt!{abc!($03 + 5)};
 "#,
         )
     }
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/tests/generated.rs b/src/tools/rust-analyzer/crates/ide-assists/src/tests/generated.rs
index 05e1aff5f9f..595ce1affb0 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/tests/generated.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/tests/generated.rs
@@ -3100,14 +3100,14 @@ macro_rules! sth {
     () => {};
 }
 
-sth! $0( );
+sth!$0( );
 "#####,
         r#####"
 macro_rules! sth {
     () => {};
 }
 
-sth! { }
+sth!{ }
 "#####,
     )
 }