@@ -15,15 +15,15 @@ use crate::{AssistContext, Assists};
15
15
// () => {};
16
16
// }
17
17
//
18
- // sth! $0( );
18
+ // sth!$0( );
19
19
// ```
20
20
// ->
21
21
// ```
22
22
// macro_rules! sth {
23
23
// () => {};
24
24
// }
25
25
//
26
- // sth! { }
26
+ // sth!{ }
27
27
// ```
28
28
pub ( crate ) fn toggle_macro_delimiter ( acc : & mut Assists , ctx : & AssistContext < ' _ > ) -> Option < ( ) > {
29
29
#[ derive( Debug ) ]
@@ -36,7 +36,7 @@ pub(crate) fn toggle_macro_delimiter(acc: &mut Assists, ctx: &AssistContext<'_>)
36
36
RCur ,
37
37
}
38
38
39
- let makro = ctx. find_node_at_offset_with_descend :: < ast:: MacroCall > ( ) ?. clone_for_update ( ) ;
39
+ let makro = ctx. find_node_at_offset :: < ast:: MacroCall > ( ) ?. clone_for_update ( ) ;
40
40
let makro_text_range = makro. syntax ( ) . text_range ( ) ;
41
41
42
42
let cursor_offset = ctx. offset ( ) ;
@@ -62,7 +62,7 @@ pub(crate) fn toggle_macro_delimiter(acc: &mut Assists, ctx: &AssistContext<'_>)
62
62
} ;
63
63
64
64
acc. add (
65
- AssistId ( "add_braces " , AssistKind :: Refactor ) ,
65
+ AssistId ( "toggle_macro_delimiter " , AssistKind :: Refactor ) ,
66
66
match token {
67
67
MacroDelims :: LPar => "Replace delimiters with braces" ,
68
68
MacroDelims :: RPar => "Replace delimiters with braces" ,
@@ -110,35 +110,35 @@ macro_rules! sth {
110
110
() => {};
111
111
}
112
112
113
- sth! $0( );
113
+ sth!$0( );
114
114
"# ,
115
115
r#"
116
116
macro_rules! sth {
117
117
() => {};
118
118
}
119
119
120
- sth! { }
120
+ sth!{ }
121
121
"# ,
122
122
)
123
123
}
124
124
125
125
#[ test]
126
- fn test_braclets ( ) {
126
+ fn test_braces ( ) {
127
127
check_assist (
128
128
toggle_macro_delimiter,
129
129
r#"
130
130
macro_rules! sth {
131
131
() => {};
132
132
}
133
133
134
- sth! $0{ };
134
+ sth!$0{ };
135
135
"# ,
136
136
r#"
137
137
macro_rules! sth {
138
138
() => {};
139
139
}
140
140
141
- sth! [ ];
141
+ sth![ ];
142
142
"# ,
143
143
)
144
144
}
@@ -152,14 +152,14 @@ macro_rules! sth {
152
152
() => {};
153
153
}
154
154
155
- sth! $0[ ];
155
+ sth!$0[ ];
156
156
"# ,
157
157
r#"
158
158
macro_rules! sth {
159
159
() => {};
160
160
}
161
161
162
- sth! ( );
162
+ sth!( );
163
163
"# ,
164
164
)
165
165
}
@@ -174,7 +174,7 @@ mod abc {
174
174
() => {};
175
175
}
176
176
177
- sth! $0{ };
177
+ sth!$0{ };
178
178
}
179
179
"# ,
180
180
r#"
@@ -183,7 +183,7 @@ mod abc {
183
183
() => {};
184
184
}
185
185
186
- sth! [ ];
186
+ sth![ ];
187
187
}
188
188
"# ,
189
189
)
@@ -196,7 +196,7 @@ mod abc {
196
196
r#"
197
197
macro_rules! prt {
198
198
($e:expr) => {{
199
- println!("{}", stringify! {$e});
199
+ println!("{}", stringify!{$e});
200
200
}};
201
201
}
202
202
@@ -213,20 +213,20 @@ prt!(($03 + 5));
213
213
r#"
214
214
macro_rules! prt {
215
215
($e:expr) => {{
216
- println!("{}", stringify! {$e});
216
+ println!("{}", stringify!{$e});
217
217
}};
218
218
}
219
219
220
- prt! $0((3 + 5));
220
+ prt!$0((3 + 5));
221
221
"# ,
222
222
r#"
223
223
macro_rules! prt {
224
224
($e:expr) => {{
225
- println!("{}", stringify! {$e});
225
+ println!("{}", stringify!{$e});
226
226
}};
227
227
}
228
228
229
- prt! {(3 + 5)}
229
+ prt!{(3 + 5)}
230
230
"# ,
231
231
)
232
232
}
@@ -239,17 +239,17 @@ prt! {(3 + 5)}
239
239
r#"
240
240
macro_rules! prt {
241
241
($e:expr) => {{
242
- println!("{}", stringify! {$e});
242
+ println!("{}", stringify!{$e});
243
243
}};
244
244
}
245
245
246
246
macro_rules! abc {
247
247
($e:expr) => {{
248
- println!("{}", stringify! {$e});
248
+ println!("{}", stringify!{$e});
249
249
}};
250
250
}
251
251
252
- prt! {abc!($03 + 5)};
252
+ prt!{abc!($03 + 5)};
253
253
"# ,
254
254
)
255
255
}
0 commit comments