Skip to content

Commit 29334b9

Browse files
committed
rustfmt diagnostic derive tests
1 parent 368c4a3 commit 29334b9

File tree

4 files changed

+80
-85
lines changed

4 files changed

+80
-85
lines changed

src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ struct HelloWarn {}
4040
//~^ ERROR unsupported type attribute for diagnostic derive enum
4141
enum DiagnosticOnEnum {
4242
Foo,
43-
//~^ ERROR diagnostic slug not specified
43+
//~^ ERROR diagnostic slug not specified
4444
Bar,
45-
//~^ ERROR diagnostic slug not specified
45+
//~^ ERROR diagnostic slug not specified
4646
}
4747

4848
#[derive(Diagnostic)]
@@ -536,8 +536,7 @@ struct LabelWithTrailingList {
536536

537537
#[derive(LintDiagnostic)]
538538
#[diag(compiletest_example)]
539-
struct LintsGood {
540-
}
539+
struct LintsGood {}
541540

542541
#[derive(LintDiagnostic)]
543542
#[diag(compiletest_example)]
@@ -683,39 +682,39 @@ struct RawIdentDiagnosticArg {
683682
#[diag(compiletest_example)]
684683
struct SubdiagnosticBad {
685684
#[subdiagnostic(bad)]
686-
//~^ ERROR `#[subdiagnostic(bad)]` is not a valid attribute
685+
//~^ ERROR `#[subdiagnostic(bad)]` is not a valid attribute
687686
note: Note,
688687
}
689688

690689
#[derive(Diagnostic)]
691690
#[diag(compiletest_example)]
692691
struct SubdiagnosticBadStr {
693692
#[subdiagnostic = "bad"]
694-
//~^ ERROR `#[subdiagnostic = ...]` is not a valid attribute
693+
//~^ ERROR `#[subdiagnostic = ...]` is not a valid attribute
695694
note: Note,
696695
}
697696

698697
#[derive(Diagnostic)]
699698
#[diag(compiletest_example)]
700699
struct SubdiagnosticBadTwice {
701700
#[subdiagnostic(bad, bad)]
702-
//~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
701+
//~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
703702
note: Note,
704703
}
705704

706705
#[derive(Diagnostic)]
707706
#[diag(compiletest_example)]
708707
struct SubdiagnosticBadLitStr {
709708
#[subdiagnostic("bad")]
710-
//~^ ERROR `#[subdiagnostic("...")]` is not a valid attribute
709+
//~^ ERROR `#[subdiagnostic("...")]` is not a valid attribute
711710
note: Note,
712711
}
713712

714713
#[derive(LintDiagnostic)]
715714
#[diag(compiletest_example)]
716715
struct SubdiagnosticEagerLint {
717716
#[subdiagnostic(eager)]
718-
//~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
717+
//~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
719718
note: Note,
720719
}
721720

@@ -731,11 +730,7 @@ struct SubdiagnosticEagerCorrect {
731730
// after the `span_suggestion` call - which breaks eager translation.
732731

733732
#[derive(Subdiagnostic)]
734-
#[suggestion_short(
735-
use_instead,
736-
applicability = "machine-applicable",
737-
code = "{correct}"
738-
)]
733+
#[suggestion_short(use_instead, applicability = "machine-applicable", code = "{correct}")]
739734
pub(crate) struct SubdiagnosticWithSuggestion {
740735
#[primary_span]
741736
span: Span,

src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -373,21 +373,21 @@ LL | #[label(label, foo("..."))]
373373
| ^^^^^^^^^^
374374

375375
error: `#[primary_span]` is not a valid attribute
376-
--> $DIR/diagnostic-derive.rs:545:5
376+
--> $DIR/diagnostic-derive.rs:544:5
377377
|
378378
LL | #[primary_span]
379379
| ^^^^^^^^^^^^^^^
380380
|
381381
= help: the `primary_span` field attribute is not valid for lint diagnostics
382382

383383
error: `#[error(...)]` is not a valid attribute
384-
--> $DIR/diagnostic-derive.rs:565:1
384+
--> $DIR/diagnostic-derive.rs:564:1
385385
|
386386
LL | #[error(compiletest_example, code = "E0123")]
387387
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
388388

389389
error: diagnostic slug not specified
390-
--> $DIR/diagnostic-derive.rs:565:1
390+
--> $DIR/diagnostic-derive.rs:564:1
391391
|
392392
LL | / #[error(compiletest_example, code = "E0123")]
393393
LL | |
@@ -399,13 +399,13 @@ LL | | struct ErrorAttribute {}
399399
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
400400

401401
error: `#[warn_(...)]` is not a valid attribute
402-
--> $DIR/diagnostic-derive.rs:572:1
402+
--> $DIR/diagnostic-derive.rs:571:1
403403
|
404404
LL | #[warn_(compiletest_example, code = "E0123")]
405405
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
406406

407407
error: diagnostic slug not specified
408-
--> $DIR/diagnostic-derive.rs:572:1
408+
--> $DIR/diagnostic-derive.rs:571:1
409409
|
410410
LL | / #[warn_(compiletest_example, code = "E0123")]
411411
LL | |
@@ -417,13 +417,13 @@ LL | | struct WarnAttribute {}
417417
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
418418

419419
error: `#[lint(...)]` is not a valid attribute
420-
--> $DIR/diagnostic-derive.rs:579:1
420+
--> $DIR/diagnostic-derive.rs:578:1
421421
|
422422
LL | #[lint(compiletest_example, code = "E0123")]
423423
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
424424

425425
error: diagnostic slug not specified
426-
--> $DIR/diagnostic-derive.rs:579:1
426+
--> $DIR/diagnostic-derive.rs:578:1
427427
|
428428
LL | / #[lint(compiletest_example, code = "E0123")]
429429
LL | |
@@ -435,19 +435,19 @@ LL | | struct LintAttributeOnSessionDiag {}
435435
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
436436

437437
error: `#[lint(...)]` is not a valid attribute
438-
--> $DIR/diagnostic-derive.rs:586:1
438+
--> $DIR/diagnostic-derive.rs:585:1
439439
|
440440
LL | #[lint(compiletest_example, code = "E0123")]
441441
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
442442

443443
error: `#[lint(...)]` is not a valid attribute
444-
--> $DIR/diagnostic-derive.rs:586:1
444+
--> $DIR/diagnostic-derive.rs:585:1
445445
|
446446
LL | #[lint(compiletest_example, code = "E0123")]
447447
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
448448

449449
error: diagnostic slug not specified
450-
--> $DIR/diagnostic-derive.rs:586:1
450+
--> $DIR/diagnostic-derive.rs:585:1
451451
|
452452
LL | / #[lint(compiletest_example, code = "E0123")]
453453
LL | |
@@ -460,133 +460,133 @@ LL | | struct LintAttributeOnLintDiag {}
460460
= help: specify the slug as the first argument to the attribute, such as `#[diag(compiletest_example)]`
461461

462462
error: specified multiple times
463-
--> $DIR/diagnostic-derive.rs:596:44
463+
--> $DIR/diagnostic-derive.rs:595:44
464464
|
465465
LL | #[suggestion(suggestion, code = "...", code = ",,,")]
466466
| ^^^^^^^^^^^^
467467
|
468468
note: previously specified here
469-
--> $DIR/diagnostic-derive.rs:596:30
469+
--> $DIR/diagnostic-derive.rs:595:30
470470
|
471471
LL | #[suggestion(suggestion, code = "...", code = ",,,")]
472472
| ^^^^^^^^^^^^
473473

474474
error: wrong types for suggestion
475-
--> $DIR/diagnostic-derive.rs:605:24
475+
--> $DIR/diagnostic-derive.rs:604:24
476476
|
477477
LL | suggestion: (Span, usize),
478478
| ^^^^^
479479
|
480480
= help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)`
481481

482482
error: wrong types for suggestion
483-
--> $DIR/diagnostic-derive.rs:613:17
483+
--> $DIR/diagnostic-derive.rs:612:17
484484
|
485485
LL | suggestion: (Span,),
486486
| ^^^^^^^
487487
|
488488
= help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)`
489489

490490
error: suggestion without `code = "..."`
491-
--> $DIR/diagnostic-derive.rs:620:5
491+
--> $DIR/diagnostic-derive.rs:619:5
492492
|
493493
LL | #[suggestion(suggestion)]
494494
| ^^^^^^^^^^^^^^^^^^^^^^^^^
495495

496496
error: `#[multipart_suggestion(...)]` is not a valid attribute
497-
--> $DIR/diagnostic-derive.rs:627:1
497+
--> $DIR/diagnostic-derive.rs:626:1
498498
|
499499
LL | #[multipart_suggestion(suggestion)]
500500
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
501501
|
502502
= help: consider creating a `Subdiagnostic` instead
503503

504504
error: `#[multipart_suggestion(...)]` is not a valid attribute
505-
--> $DIR/diagnostic-derive.rs:630:1
505+
--> $DIR/diagnostic-derive.rs:629:1
506506
|
507507
LL | #[multipart_suggestion()]
508508
| ^^^^^^^^^^^^^^^^^^^^^^^^^
509509
|
510510
= help: consider creating a `Subdiagnostic` instead
511511

512512
error: `#[multipart_suggestion(...)]` is not a valid attribute
513-
--> $DIR/diagnostic-derive.rs:634:5
513+
--> $DIR/diagnostic-derive.rs:633:5
514514
|
515515
LL | #[multipart_suggestion(suggestion)]
516516
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
517517
|
518518
= help: consider creating a `Subdiagnostic` instead
519519

520520
error: `#[suggestion(...)]` is not a valid attribute
521-
--> $DIR/diagnostic-derive.rs:642:1
521+
--> $DIR/diagnostic-derive.rs:641:1
522522
|
523523
LL | #[suggestion(suggestion, code = "...")]
524524
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
525525
|
526526
= help: `#[label]` and `#[suggestion]` can only be applied to fields
527527

528528
error: `#[label]` is not a valid attribute
529-
--> $DIR/diagnostic-derive.rs:651:1
529+
--> $DIR/diagnostic-derive.rs:650:1
530530
|
531531
LL | #[label]
532532
| ^^^^^^^^
533533
|
534534
= help: `#[label]` and `#[suggestion]` can only be applied to fields
535535

536536
error: `#[subdiagnostic(bad)]` is not a valid attribute
537-
--> $DIR/diagnostic-derive.rs:685:21
537+
--> $DIR/diagnostic-derive.rs:684:21
538538
|
539539
LL | #[subdiagnostic(bad)]
540540
| ^^^
541541
|
542542
= help: `eager` is the only supported nested attribute for `subdiagnostic`
543543

544544
error: `#[subdiagnostic = ...]` is not a valid attribute
545-
--> $DIR/diagnostic-derive.rs:693:5
545+
--> $DIR/diagnostic-derive.rs:692:5
546546
|
547547
LL | #[subdiagnostic = "bad"]
548548
| ^^^^^^^^^^^^^^^^^^^^^^^^
549549
|
550550
= help: `eager` is the only supported nested attribute for `subdiagnostic`
551551

552552
error: `#[subdiagnostic(...)]` is not a valid attribute
553-
--> $DIR/diagnostic-derive.rs:701:5
553+
--> $DIR/diagnostic-derive.rs:700:5
554554
|
555555
LL | #[subdiagnostic(bad, bad)]
556556
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
557557
|
558558
= help: `eager` is the only supported nested attribute for `subdiagnostic`
559559

560560
error: `#[subdiagnostic("...")]` is not a valid attribute
561-
--> $DIR/diagnostic-derive.rs:709:21
561+
--> $DIR/diagnostic-derive.rs:708:21
562562
|
563563
LL | #[subdiagnostic("bad")]
564564
| ^^^^^
565565
|
566566
= help: `eager` is the only supported nested attribute for `subdiagnostic`
567567

568568
error: `#[subdiagnostic(...)]` is not a valid attribute
569-
--> $DIR/diagnostic-derive.rs:717:5
569+
--> $DIR/diagnostic-derive.rs:716:5
570570
|
571571
LL | #[subdiagnostic(eager)]
572572
| ^^^^^^^^^^^^^^^^^^^^^^^
573573
|
574574
= help: eager subdiagnostics are not supported on lints
575575

576576
error: expected at least one string literal for `code(...)`
577-
--> $DIR/diagnostic-derive.rs:779:18
577+
--> $DIR/diagnostic-derive.rs:774:18
578578
|
579579
LL | #[suggestion(code())]
580580
| ^^^^^^
581581

582582
error: `code(...)` must contain only string literals
583-
--> $DIR/diagnostic-derive.rs:787:23
583+
--> $DIR/diagnostic-derive.rs:782:23
584584
|
585585
LL | #[suggestion(code(foo))]
586586
| ^^^
587587

588588
error: `code = "..."`/`code(...)` must contain only string literals
589-
--> $DIR/diagnostic-derive.rs:795:18
589+
--> $DIR/diagnostic-derive.rs:790:18
590590
|
591591
LL | #[suggestion(code = 3)]
592592
| ^^^^^^^^
@@ -604,43 +604,43 @@ LL | #[nonsense]
604604
| ^^^^^^^^
605605

606606
error: cannot find attribute `error` in this scope
607-
--> $DIR/diagnostic-derive.rs:565:3
607+
--> $DIR/diagnostic-derive.rs:564:3
608608
|
609609
LL | #[error(compiletest_example, code = "E0123")]
610610
| ^^^^^
611611

612612
error: cannot find attribute `warn_` in this scope
613-
--> $DIR/diagnostic-derive.rs:572:3
613+
--> $DIR/diagnostic-derive.rs:571:3
614614
|
615615
LL | #[warn_(compiletest_example, code = "E0123")]
616616
| ^^^^^ help: a built-in attribute with a similar name exists: `warn`
617617

618618
error: cannot find attribute `lint` in this scope
619-
--> $DIR/diagnostic-derive.rs:579:3
619+
--> $DIR/diagnostic-derive.rs:578:3
620620
|
621621
LL | #[lint(compiletest_example, code = "E0123")]
622622
| ^^^^ help: a built-in attribute with a similar name exists: `link`
623623

624624
error: cannot find attribute `lint` in this scope
625-
--> $DIR/diagnostic-derive.rs:586:3
625+
--> $DIR/diagnostic-derive.rs:585:3
626626
|
627627
LL | #[lint(compiletest_example, code = "E0123")]
628628
| ^^^^ help: a built-in attribute with a similar name exists: `link`
629629

630630
error: cannot find attribute `multipart_suggestion` in this scope
631-
--> $DIR/diagnostic-derive.rs:627:3
631+
--> $DIR/diagnostic-derive.rs:626:3
632632
|
633633
LL | #[multipart_suggestion(suggestion)]
634634
| ^^^^^^^^^^^^^^^^^^^^
635635

636636
error: cannot find attribute `multipart_suggestion` in this scope
637-
--> $DIR/diagnostic-derive.rs:630:3
637+
--> $DIR/diagnostic-derive.rs:629:3
638638
|
639639
LL | #[multipart_suggestion()]
640640
| ^^^^^^^^^^^^^^^^^^^^
641641

642642
error: cannot find attribute `multipart_suggestion` in this scope
643-
--> $DIR/diagnostic-derive.rs:634:7
643+
--> $DIR/diagnostic-derive.rs:633:7
644644
|
645645
LL | #[multipart_suggestion(suggestion)]
646646
| ^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)