aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_assists/src/handlers')
-rw-r--r--crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs56
1 files changed, 28 insertions, 28 deletions
diff --git a/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs b/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs
index 47d8b9c91..694d897d1 100644
--- a/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs
+++ b/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs
@@ -212,7 +212,7 @@ mod tests {
212 fn add_custom_impl_debug() { 212 fn add_custom_impl_debug() {
213 check_assist( 213 check_assist(
214 replace_derive_with_manual_impl, 214 replace_derive_with_manual_impl,
215 " 215 r#"
216mod fmt { 216mod fmt {
217 pub struct Error; 217 pub struct Error;
218 pub type Result = Result<(), Error>; 218 pub type Result = Result<(), Error>;
@@ -226,8 +226,8 @@ mod fmt {
226struct Foo { 226struct Foo {
227 bar: String, 227 bar: String,
228} 228}
229", 229"#,
230 " 230 r#"
231mod fmt { 231mod fmt {
232 pub struct Error; 232 pub struct Error;
233 pub type Result = Result<(), Error>; 233 pub type Result = Result<(), Error>;
@@ -246,14 +246,14 @@ impl fmt::Debug for Foo {
246 ${0:todo!()} 246 ${0:todo!()}
247 } 247 }
248} 248}
249", 249"#,
250 ) 250 )
251 } 251 }
252 #[test] 252 #[test]
253 fn add_custom_impl_all() { 253 fn add_custom_impl_all() {
254 check_assist( 254 check_assist(
255 replace_derive_with_manual_impl, 255 replace_derive_with_manual_impl,
256 " 256 r#"
257mod foo { 257mod foo {
258 pub trait Bar { 258 pub trait Bar {
259 type Qux; 259 type Qux;
@@ -268,8 +268,8 @@ mod foo {
268struct Foo { 268struct Foo {
269 bar: String, 269 bar: String,
270} 270}
271", 271"#,
272 " 272 r#"
273mod foo { 273mod foo {
274 pub trait Bar { 274 pub trait Bar {
275 type Qux; 275 type Qux;
@@ -295,20 +295,20 @@ impl foo::Bar for Foo {
295 todo!() 295 todo!()
296 } 296 }
297} 297}
298", 298"#,
299 ) 299 )
300 } 300 }
301 #[test] 301 #[test]
302 fn add_custom_impl_for_unique_input() { 302 fn add_custom_impl_for_unique_input() {
303 check_assist( 303 check_assist(
304 replace_derive_with_manual_impl, 304 replace_derive_with_manual_impl,
305 " 305 r#"
306#[derive(Debu$0g)] 306#[derive(Debu$0g)]
307struct Foo { 307struct Foo {
308 bar: String, 308 bar: String,
309} 309}
310 ", 310 "#,
311 " 311 r#"
312struct Foo { 312struct Foo {
313 bar: String, 313 bar: String,
314} 314}
@@ -316,7 +316,7 @@ struct Foo {
316impl Debug for Foo { 316impl Debug for Foo {
317 $0 317 $0
318} 318}
319 ", 319 "#,
320 ) 320 )
321 } 321 }
322 322
@@ -324,13 +324,13 @@ impl Debug for Foo {
324 fn add_custom_impl_for_with_visibility_modifier() { 324 fn add_custom_impl_for_with_visibility_modifier() {
325 check_assist( 325 check_assist(
326 replace_derive_with_manual_impl, 326 replace_derive_with_manual_impl,
327 " 327 r#"
328#[derive(Debug$0)] 328#[derive(Debug$0)]
329pub struct Foo { 329pub struct Foo {
330 bar: String, 330 bar: String,
331} 331}
332 ", 332 "#,
333 " 333 r#"
334pub struct Foo { 334pub struct Foo {
335 bar: String, 335 bar: String,
336} 336}
@@ -338,7 +338,7 @@ pub struct Foo {
338impl Debug for Foo { 338impl Debug for Foo {
339 $0 339 $0
340} 340}
341 ", 341 "#,
342 ) 342 )
343 } 343 }
344 344
@@ -346,18 +346,18 @@ impl Debug for Foo {
346 fn add_custom_impl_when_multiple_inputs() { 346 fn add_custom_impl_when_multiple_inputs() {
347 check_assist( 347 check_assist(
348 replace_derive_with_manual_impl, 348 replace_derive_with_manual_impl,
349 " 349 r#"
350#[derive(Display, Debug$0, Serialize)] 350#[derive(Display, Debug$0, Serialize)]
351struct Foo {} 351struct Foo {}
352 ", 352 "#,
353 " 353 r#"
354#[derive(Display, Serialize)] 354#[derive(Display, Serialize)]
355struct Foo {} 355struct Foo {}
356 356
357impl Debug for Foo { 357impl Debug for Foo {
358 $0 358 $0
359} 359}
360 ", 360 "#,
361 ) 361 )
362 } 362 }
363 363
@@ -365,10 +365,10 @@ impl Debug for Foo {
365 fn test_ignore_derive_macro_without_input() { 365 fn test_ignore_derive_macro_without_input() {
366 check_assist_not_applicable( 366 check_assist_not_applicable(
367 replace_derive_with_manual_impl, 367 replace_derive_with_manual_impl,
368 " 368 r#"
369#[derive($0)] 369#[derive($0)]
370struct Foo {} 370struct Foo {}
371 ", 371 "#,
372 ) 372 )
373 } 373 }
374 374
@@ -376,18 +376,18 @@ struct Foo {}
376 fn test_ignore_if_cursor_on_param() { 376 fn test_ignore_if_cursor_on_param() {
377 check_assist_not_applicable( 377 check_assist_not_applicable(
378 replace_derive_with_manual_impl, 378 replace_derive_with_manual_impl,
379 " 379 r#"
380#[derive$0(Debug)] 380#[derive$0(Debug)]
381struct Foo {} 381struct Foo {}
382 ", 382 "#,
383 ); 383 );
384 384
385 check_assist_not_applicable( 385 check_assist_not_applicable(
386 replace_derive_with_manual_impl, 386 replace_derive_with_manual_impl,
387 " 387 r#"
388#[derive(Debug)$0] 388#[derive(Debug)$0]
389struct Foo {} 389struct Foo {}
390 ", 390 "#,
391 ) 391 )
392 } 392 }
393 393
@@ -395,10 +395,10 @@ struct Foo {}
395 fn test_ignore_if_not_derive() { 395 fn test_ignore_if_not_derive() {
396 check_assist_not_applicable( 396 check_assist_not_applicable(
397 replace_derive_with_manual_impl, 397 replace_derive_with_manual_impl,
398 " 398 r#"
399#[allow(non_camel_$0case_types)] 399#[allow(non_camel_$0case_types)]
400struct Foo {} 400struct Foo {}
401 ", 401 "#,
402 ) 402 )
403 } 403 }
404 404