Skip to content

Commit c9a3b02

Browse files
committed
Fix tests
1 parent 662f02f commit c9a3b02

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/tools/rust-analyzer/crates/ide-assists/src/handlers/toggle_macro_delimiter.rs

+21-21
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ use crate::{AssistContext, Assists};
1515
// () => {};
1616
// }
1717
//
18-
// sth! $0( );
18+
// sth!$0( );
1919
// ```
2020
// ->
2121
// ```
2222
// macro_rules! sth {
2323
// () => {};
2424
// }
2525
//
26-
// sth! { }
26+
// sth!{ }
2727
// ```
2828
pub(crate) fn toggle_macro_delimiter(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<()> {
2929
#[derive(Debug)]
@@ -36,7 +36,7 @@ pub(crate) fn toggle_macro_delimiter(acc: &mut Assists, ctx: &AssistContext<'_>)
3636
RCur,
3737
}
3838

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();
4040
let makro_text_range = makro.syntax().text_range();
4141

4242
let cursor_offset = ctx.offset();
@@ -62,7 +62,7 @@ pub(crate) fn toggle_macro_delimiter(acc: &mut Assists, ctx: &AssistContext<'_>)
6262
};
6363

6464
acc.add(
65-
AssistId("add_braces", AssistKind::Refactor),
65+
AssistId("toggle_macro_delimiter", AssistKind::Refactor),
6666
match token {
6767
MacroDelims::LPar => "Replace delimiters with braces",
6868
MacroDelims::RPar => "Replace delimiters with braces",
@@ -110,35 +110,35 @@ macro_rules! sth {
110110
() => {};
111111
}
112112
113-
sth! $0( );
113+
sth!$0( );
114114
"#,
115115
r#"
116116
macro_rules! sth {
117117
() => {};
118118
}
119119
120-
sth! { }
120+
sth!{ }
121121
"#,
122122
)
123123
}
124124

125125
#[test]
126-
fn test_braclets() {
126+
fn test_braces() {
127127
check_assist(
128128
toggle_macro_delimiter,
129129
r#"
130130
macro_rules! sth {
131131
() => {};
132132
}
133133
134-
sth! $0{ };
134+
sth!$0{ };
135135
"#,
136136
r#"
137137
macro_rules! sth {
138138
() => {};
139139
}
140140
141-
sth! [ ];
141+
sth![ ];
142142
"#,
143143
)
144144
}
@@ -152,14 +152,14 @@ macro_rules! sth {
152152
() => {};
153153
}
154154
155-
sth! $0[ ];
155+
sth!$0[ ];
156156
"#,
157157
r#"
158158
macro_rules! sth {
159159
() => {};
160160
}
161161
162-
sth! ( );
162+
sth!( );
163163
"#,
164164
)
165165
}
@@ -174,7 +174,7 @@ mod abc {
174174
() => {};
175175
}
176176
177-
sth! $0{ };
177+
sth!$0{ };
178178
}
179179
"#,
180180
r#"
@@ -183,7 +183,7 @@ mod abc {
183183
() => {};
184184
}
185185
186-
sth! [ ];
186+
sth![ ];
187187
}
188188
"#,
189189
)
@@ -196,7 +196,7 @@ mod abc {
196196
r#"
197197
macro_rules! prt {
198198
($e:expr) => {{
199-
println!("{}", stringify! {$e});
199+
println!("{}", stringify!{$e});
200200
}};
201201
}
202202
@@ -213,20 +213,20 @@ prt!(($03 + 5));
213213
r#"
214214
macro_rules! prt {
215215
($e:expr) => {{
216-
println!("{}", stringify! {$e});
216+
println!("{}", stringify!{$e});
217217
}};
218218
}
219219
220-
prt! $0((3 + 5));
220+
prt!$0((3 + 5));
221221
"#,
222222
r#"
223223
macro_rules! prt {
224224
($e:expr) => {{
225-
println!("{}", stringify! {$e});
225+
println!("{}", stringify!{$e});
226226
}};
227227
}
228228
229-
prt! {(3 + 5)}
229+
prt!{(3 + 5)}
230230
"#,
231231
)
232232
}
@@ -239,17 +239,17 @@ prt! {(3 + 5)}
239239
r#"
240240
macro_rules! prt {
241241
($e:expr) => {{
242-
println!("{}", stringify! {$e});
242+
println!("{}", stringify!{$e});
243243
}};
244244
}
245245
246246
macro_rules! abc {
247247
($e:expr) => {{
248-
println!("{}", stringify! {$e});
248+
println!("{}", stringify!{$e});
249249
}};
250250
}
251251
252-
prt! {abc!($03 + 5)};
252+
prt!{abc!($03 + 5)};
253253
"#,
254254
)
255255
}

src/tools/rust-analyzer/crates/ide-assists/src/tests/generated.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3100,14 +3100,14 @@ macro_rules! sth {
31003100
() => {};
31013101
}
31023102
3103-
sth! $0( );
3103+
sth!$0( );
31043104
"#####,
31053105
r#####"
31063106
macro_rules! sth {
31073107
() => {};
31083108
}
31093109
3110-
sth! { }
3110+
sth!{ }
31113111
"#####,
31123112
)
31133113
}

0 commit comments

Comments
 (0)