diff options
Diffstat (limited to 'crates/ide_assists/src')
-rw-r--r-- | crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs | 56 |
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#" |
216 | mod fmt { | 216 | mod 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 { | |||
226 | struct Foo { | 226 | struct Foo { |
227 | bar: String, | 227 | bar: String, |
228 | } | 228 | } |
229 | ", | 229 | "#, |
230 | " | 230 | r#" |
231 | mod fmt { | 231 | mod 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#" |
257 | mod foo { | 257 | mod foo { |
258 | pub trait Bar { | 258 | pub trait Bar { |
259 | type Qux; | 259 | type Qux; |
@@ -268,8 +268,8 @@ mod foo { | |||
268 | struct Foo { | 268 | struct Foo { |
269 | bar: String, | 269 | bar: String, |
270 | } | 270 | } |
271 | ", | 271 | "#, |
272 | " | 272 | r#" |
273 | mod foo { | 273 | mod 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)] |
307 | struct Foo { | 307 | struct Foo { |
308 | bar: String, | 308 | bar: String, |
309 | } | 309 | } |
310 | ", | 310 | "#, |
311 | " | 311 | r#" |
312 | struct Foo { | 312 | struct Foo { |
313 | bar: String, | 313 | bar: String, |
314 | } | 314 | } |
@@ -316,7 +316,7 @@ struct Foo { | |||
316 | impl Debug for Foo { | 316 | impl 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)] |
329 | pub struct Foo { | 329 | pub struct Foo { |
330 | bar: String, | 330 | bar: String, |
331 | } | 331 | } |
332 | ", | 332 | "#, |
333 | " | 333 | r#" |
334 | pub struct Foo { | 334 | pub struct Foo { |
335 | bar: String, | 335 | bar: String, |
336 | } | 336 | } |
@@ -338,7 +338,7 @@ pub struct Foo { | |||
338 | impl Debug for Foo { | 338 | impl 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)] |
351 | struct Foo {} | 351 | struct Foo {} |
352 | ", | 352 | "#, |
353 | " | 353 | r#" |
354 | #[derive(Display, Serialize)] | 354 | #[derive(Display, Serialize)] |
355 | struct Foo {} | 355 | struct Foo {} |
356 | 356 | ||
357 | impl Debug for Foo { | 357 | impl 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)] |
370 | struct Foo {} | 370 | struct 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)] |
381 | struct Foo {} | 381 | struct 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] |
389 | struct Foo {} | 389 | struct 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)] |
400 | struct Foo {} | 400 | struct Foo {} |
401 | ", | 401 | "#, |
402 | ) | 402 | ) |
403 | } | 403 | } |
404 | 404 | ||