Skip to content

Commit 7e0d4e1

Browse files
committed
Resolve non_local_definitions warning in debug impls
warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/lit.rs:564:13 | 564 | / impl LitStr { 565 | | pub(crate) fn debug( 566 | | &self, 567 | | formatter: &mut fmt::Formatter, ... | 574 | | } 575 | | } | |_____________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> = note: `#[warn(non_local_definitions)]` on by default warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/lit.rs:583:13 | 583 | / impl LitByteStr { 584 | | pub(crate) fn debug( 585 | | &self, 586 | | formatter: &mut fmt::Formatter, ... | 593 | | } 594 | | } | |_____________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/lit.rs:602:13 | 602 | / impl LitByte { 603 | | pub(crate) fn debug( 604 | | &self, 605 | | formatter: &mut fmt::Formatter, ... | 612 | | } 613 | | } | |_____________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/lit.rs:621:13 | 621 | / impl LitChar { 622 | | pub(crate) fn debug( 623 | | &self, 624 | | formatter: &mut fmt::Formatter, ... | 631 | | } 632 | | } | |_____________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/lit.rs:640:13 | 640 | / impl LitInt { 641 | | pub(crate) fn debug( 642 | | &self, 643 | | formatter: &mut fmt::Formatter, ... | 650 | | } 651 | | } | |_____________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/lit.rs:659:13 | 659 | / impl LitFloat { 660 | | pub(crate) fn debug( 661 | | &self, 662 | | formatter: &mut fmt::Formatter, ... | 669 | | } 670 | | } | |_____________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/lit.rs:678:13 | 678 | / impl LitBool { 679 | | pub(crate) fn debug( 680 | | &self, 681 | | formatter: &mut fmt::Formatter, ... | 688 | | } 689 | | } | |_____________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:19:9 | 19 | / impl crate::AngleBracketedGenericArguments { 20 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 21 | | let mut formatter = formatter.debug_struct(name); 22 | | formatter.field("colon2_token", &self.colon2_token); ... | 27 | | } 28 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:334:9 | 334 | / impl crate::DataEnum { 335 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 336 | | let mut formatter = formatter.debug_struct(name); 337 | | formatter.field("enum_token", &self.enum_token); ... | 341 | | } 342 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:350:9 | 350 | / impl crate::DataStruct { 351 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 352 | | let mut formatter = formatter.debug_struct(name); 353 | | formatter.field("struct_token", &self.struct_token); ... | 357 | | } 358 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:366:9 | 366 | / impl crate::DataUnion { 367 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 368 | | let mut formatter = formatter.debug_struct(name); 369 | | formatter.field("union_token", &self.union_token); ... | 372 | | } 373 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:472:9 | 472 | / impl crate::ExprArray { 473 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 474 | | let mut formatter = formatter.debug_struct(name); 475 | | formatter.field("attrs", &self.attrs); ... | 479 | | } 480 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:488:9 | 488 | / impl crate::ExprAssign { 489 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 490 | | let mut formatter = formatter.debug_struct(name); 491 | | formatter.field("attrs", &self.attrs); ... | 496 | | } 497 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:505:9 | 505 | / impl crate::ExprAsync { 506 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 507 | | let mut formatter = formatter.debug_struct(name); 508 | | formatter.field("attrs", &self.attrs); ... | 513 | | } 514 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:522:9 | 522 | / impl crate::ExprAwait { 523 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 524 | | let mut formatter = formatter.debug_struct(name); 525 | | formatter.field("attrs", &self.attrs); ... | 530 | | } 531 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:539:9 | 539 | / impl crate::ExprBinary { 540 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 541 | | let mut formatter = formatter.debug_struct(name); 542 | | formatter.field("attrs", &self.attrs); ... | 547 | | } 548 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:556:9 | 556 | / impl crate::ExprBlock { 557 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 558 | | let mut formatter = formatter.debug_struct(name); 559 | | formatter.field("attrs", &self.attrs); ... | 563 | | } 564 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:572:9 | 572 | / impl crate::ExprBreak { 573 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 574 | | let mut formatter = formatter.debug_struct(name); 575 | | formatter.field("attrs", &self.attrs); ... | 580 | | } 581 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:589:9 | 589 | / impl crate::ExprCall { 590 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 591 | | let mut formatter = formatter.debug_struct(name); 592 | | formatter.field("attrs", &self.attrs); ... | 597 | | } 598 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:606:9 | 606 | / impl crate::ExprCast { 607 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 608 | | let mut formatter = formatter.debug_struct(name); 609 | | formatter.field("attrs", &self.attrs); ... | 614 | | } 615 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:623:9 | 623 | / impl crate::ExprClosure { 624 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 625 | | let mut formatter = formatter.debug_struct(name); 626 | | formatter.field("attrs", &self.attrs); ... | 638 | | } 639 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:647:9 | 647 | / impl crate::ExprConst { 648 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 649 | | let mut formatter = formatter.debug_struct(name); 650 | | formatter.field("attrs", &self.attrs); ... | 654 | | } 655 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:663:9 | 663 | / impl crate::ExprContinue { 664 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 665 | | let mut formatter = formatter.debug_struct(name); 666 | | formatter.field("attrs", &self.attrs); ... | 670 | | } 671 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:679:9 | 679 | / impl crate::ExprField { 680 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 681 | | let mut formatter = formatter.debug_struct(name); 682 | | formatter.field("attrs", &self.attrs); ... | 687 | | } 688 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:696:9 | 696 | / impl crate::ExprForLoop { 697 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 698 | | let mut formatter = formatter.debug_struct(name); 699 | | formatter.field("attrs", &self.attrs); ... | 707 | | } 708 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:716:9 | 716 | / impl crate::ExprGroup { 717 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 718 | | let mut formatter = formatter.debug_struct(name); 719 | | formatter.field("attrs", &self.attrs); ... | 723 | | } 724 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:732:9 | 732 | / impl crate::ExprIf { 733 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 734 | | let mut formatter = formatter.debug_struct(name); 735 | | formatter.field("attrs", &self.attrs); ... | 741 | | } 742 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:750:9 | 750 | / impl crate::ExprIndex { 751 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 752 | | let mut formatter = formatter.debug_struct(name); 753 | | formatter.field("attrs", &self.attrs); ... | 758 | | } 759 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:767:9 | 767 | / impl crate::ExprInfer { 768 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 769 | | let mut formatter = formatter.debug_struct(name); 770 | | formatter.field("attrs", &self.attrs); ... | 773 | | } 774 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:782:9 | 782 | / impl crate::ExprLet { 783 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 784 | | let mut formatter = formatter.debug_struct(name); 785 | | formatter.field("attrs", &self.attrs); ... | 791 | | } 792 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:800:9 | 800 | / impl crate::ExprLit { 801 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 802 | | let mut formatter = formatter.debug_struct(name); 803 | | formatter.field("attrs", &self.attrs); ... | 806 | | } 807 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:815:9 | 815 | / impl crate::ExprLoop { 816 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 817 | | let mut formatter = formatter.debug_struct(name); 818 | | formatter.field("attrs", &self.attrs); ... | 823 | | } 824 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:832:9 | 832 | / impl crate::ExprMacro { 833 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 834 | | let mut formatter = formatter.debug_struct(name); 835 | | formatter.field("attrs", &self.attrs); ... | 838 | | } 839 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:847:9 | 847 | / impl crate::ExprMatch { 848 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 849 | | let mut formatter = formatter.debug_struct(name); 850 | | formatter.field("attrs", &self.attrs); ... | 856 | | } 857 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:865:9 | 865 | / impl crate::ExprMethodCall { 866 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 867 | | let mut formatter = formatter.debug_struct(name); 868 | | formatter.field("attrs", &self.attrs); ... | 876 | | } 877 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:885:9 | 885 | / impl crate::ExprParen { 886 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 887 | | let mut formatter = formatter.debug_struct(name); 888 | | formatter.field("attrs", &self.attrs); ... | 892 | | } 893 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:901:9 | 901 | / impl crate::ExprPath { 902 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 903 | | let mut formatter = formatter.debug_struct(name); 904 | | formatter.field("attrs", &self.attrs); ... | 908 | | } 909 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:917:9 | 917 | / impl crate::ExprRange { 918 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 919 | | let mut formatter = formatter.debug_struct(name); 920 | | formatter.field("attrs", &self.attrs); ... | 925 | | } 926 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:934:9 | 934 | / impl crate::ExprReference { 935 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 936 | | let mut formatter = formatter.debug_struct(name); 937 | | formatter.field("attrs", &self.attrs); ... | 942 | | } 943 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:951:9 | 951 | / impl crate::ExprRepeat { 952 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 953 | | let mut formatter = formatter.debug_struct(name); 954 | | formatter.field("attrs", &self.attrs); ... | 960 | | } 961 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:969:9 | 969 | / impl crate::ExprReturn { 970 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 971 | | let mut formatter = formatter.debug_struct(name); 972 | | formatter.field("attrs", &self.attrs); ... | 976 | | } 977 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:985:9 | 985 | / impl crate::ExprStruct { 986 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 987 | | let mut formatter = formatter.debug_struct(name); 988 | | formatter.field("attrs", &self.attrs); ... | 996 | | } 997 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1005:9 | 1005 | / impl crate::ExprTry { 1006 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1007 | | let mut formatter = formatter.debug_struct(name); 1008 | | formatter.field("attrs", &self.attrs); ... | 1012 | | } 1013 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1021:9 | 1021 | / impl crate::ExprTryBlock { 1022 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1023 | | let mut formatter = formatter.debug_struct(name); 1024 | | formatter.field("attrs", &self.attrs); ... | 1028 | | } 1029 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1037:9 | 1037 | / impl crate::ExprTuple { 1038 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1039 | | let mut formatter = formatter.debug_struct(name); 1040 | | formatter.field("attrs", &self.attrs); ... | 1044 | | } 1045 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1053:9 | 1053 | / impl crate::ExprUnary { 1054 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1055 | | let mut formatter = formatter.debug_struct(name); 1056 | | formatter.field("attrs", &self.attrs); ... | 1060 | | } 1061 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1069:9 | 1069 | / impl crate::ExprUnsafe { 1070 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1071 | | let mut formatter = formatter.debug_struct(name); 1072 | | formatter.field("attrs", &self.attrs); ... | 1076 | | } 1077 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1085:9 | 1085 | / impl crate::ExprWhile { 1086 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1087 | | let mut formatter = formatter.debug_struct(name); 1088 | | formatter.field("attrs", &self.attrs); ... | 1094 | | } 1095 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1103:9 | 1103 | / impl crate::ExprYield { 1104 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1105 | | let mut formatter = formatter.debug_struct(name); 1106 | | formatter.field("attrs", &self.attrs); ... | 1110 | | } 1111 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1179:9 | 1179 | / impl crate::FieldsNamed { 1180 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1181 | | let mut formatter = formatter.debug_struct(name); 1182 | | formatter.field("brace_token", &self.brace_token); ... | 1185 | | } 1186 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1194:9 | 1194 | / impl crate::FieldsUnnamed { 1195 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1196 | | let mut formatter = formatter.debug_struct(name); 1197 | | formatter.field("paren_token", &self.paren_token); ... | 1200 | | } 1201 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1257:9 | 1257 | / impl crate::ForeignItemFn { 1258 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1259 | | let mut formatter = formatter.debug_struct(name); 1260 | | formatter.field("attrs", &self.attrs); ... | 1265 | | } 1266 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1274:9 | 1274 | / impl crate::ForeignItemMacro { 1275 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1276 | | let mut formatter = formatter.debug_struct(name); 1277 | | formatter.field("attrs", &self.attrs); ... | 1281 | | } 1282 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1290:9 | 1290 | / impl crate::ForeignItemStatic { 1291 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1292 | | let mut formatter = formatter.debug_struct(name); 1293 | | formatter.field("attrs", &self.attrs); ... | 1302 | | } 1303 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1311:9 | 1311 | / impl crate::ForeignItemType { 1312 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1313 | | let mut formatter = formatter.debug_struct(name); 1314 | | formatter.field("attrs", &self.attrs); ... | 1321 | | } 1322 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1423:9 | 1423 | / impl crate::ImplItemConst { 1424 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1425 | | let mut formatter = formatter.debug_struct(name); 1426 | | formatter.field("attrs", &self.attrs); ... | 1438 | | } 1439 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1447:9 | 1447 | / impl crate::ImplItemFn { 1448 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1449 | | let mut formatter = formatter.debug_struct(name); 1450 | | formatter.field("attrs", &self.attrs); ... | 1456 | | } 1457 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1465:9 | 1465 | / impl crate::ImplItemMacro { 1466 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1467 | | let mut formatter = formatter.debug_struct(name); 1468 | | formatter.field("attrs", &self.attrs); ... | 1472 | | } 1473 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1481:9 | 1481 | / impl crate::ImplItemType { 1482 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1483 | | let mut formatter = formatter.debug_struct(name); 1484 | | formatter.field("attrs", &self.attrs); ... | 1494 | | } 1495 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1549:9 | 1549 | / impl crate::ItemConst { 1550 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1551 | | let mut formatter = formatter.debug_struct(name); 1552 | | formatter.field("attrs", &self.attrs); ... | 1563 | | } 1564 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/debug.rs:1572:9 | 1572 | / impl crate::ItemEnum { 1573 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1574 | | let mut formatter = formatter.debug_struct(name); 1575 | | formatter.field("attrs", &self.attrs); ... | 1583 | | } 1584 | | } | |_________^ | …
1 parent 8667ad9 commit 7e0d4e1

File tree

5 files changed

+1300
-1194
lines changed

5 files changed

+1300
-1194
lines changed

codegen/src/cfg.rs

+22-10
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,40 @@ use proc_macro2::TokenStream;
22
use quote::quote;
33
use syn_codegen::Features;
44

5-
pub fn features<'a>(
6-
features: &Features,
7-
overriding_cfg: impl Into<Option<&'a str>>,
8-
) -> TokenStream {
5+
pub enum DocCfg {
6+
Ordinary,
7+
Override(&'static str),
8+
None,
9+
}
10+
11+
impl From<&'static str> for DocCfg {
12+
fn from(overriding_cfg: &'static str) -> Self {
13+
DocCfg::Override(overriding_cfg)
14+
}
15+
}
16+
17+
pub fn features(features: &Features, doc_cfg: impl Into<DocCfg>) -> TokenStream {
918
let features = &features.any;
1019
let cfg = match features.len() {
1120
0 => None,
1221
1 => Some(quote! { cfg(feature = #(#features)*) }),
1322
_ => Some(quote! { cfg(any(#(feature = #features),*)) }),
1423
};
15-
match (cfg, overriding_cfg.into()) {
16-
(Some(cfg), Some(overriding_cfg)) => quote! {
24+
match (cfg, doc_cfg.into()) {
25+
(Some(cfg), DocCfg::Ordinary) => quote! {
26+
#[#cfg]
27+
#[cfg_attr(doc_cfg, doc(#cfg))]
28+
},
29+
(Some(cfg), DocCfg::Override(overriding_cfg)) => quote! {
1730
#[#cfg]
1831
#[cfg_attr(doc_cfg, doc(cfg(feature = #overriding_cfg)))]
1932
},
20-
(Some(cfg), None) => quote! {
33+
(Some(cfg), DocCfg::None) => quote! {
2134
#[#cfg]
22-
#[cfg_attr(doc_cfg, doc(#cfg))]
2335
},
24-
(None, Some(overriding_cfg)) => quote! {
36+
(None, DocCfg::Override(overriding_cfg)) => quote! {
2537
#[cfg_attr(doc_cfg, doc(cfg(feature = #overriding_cfg)))]
2638
},
27-
(None, None) => TokenStream::new(),
39+
(None, DocCfg::Ordinary | DocCfg::None) => TokenStream::new(),
2840
}
2941
}

codegen/src/debug.rs

+32-21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use crate::{cfg, file, lookup};
1+
use crate::cfg::{self, DocCfg};
2+
use crate::{file, lookup};
23
use anyhow::Result;
34
use proc_macro2::{Ident, Span, TokenStream};
45
use quote::{format_ident, quote};
@@ -49,7 +50,7 @@ fn expand_impl_body(
4950
let ident = Ident::new(type_name, Span::call_site());
5051
let is_syntax_tree_variant = syntax_tree_variants.contains(type_name.as_str());
5152

52-
let body = match &node.data {
53+
match &node.data {
5354
Data::Enum(variants) if variants.is_empty() => quote!(match *self {}),
5455
Data::Enum(variants) => {
5556
assert!(!is_syntax_tree_variant);
@@ -124,19 +125,6 @@ fn expand_impl_body(
124125
}
125126
}
126127
Data::Private => unreachable!(),
127-
};
128-
129-
if is_syntax_tree_variant {
130-
quote! {
131-
impl crate::#ident {
132-
fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result {
133-
#body
134-
}
135-
}
136-
self.debug(formatter, #type_name)
137-
}
138-
} else {
139-
body
140128
}
141129
}
142130

@@ -146,19 +134,40 @@ fn expand_impl(defs: &Definitions, node: &Node, syntax_tree_variants: &Set<&str>
146134
return TokenStream::new();
147135
}
148136

149-
let ident = Ident::new(&node.ident, Span::call_site());
137+
let type_name = &node.ident;
138+
let ident = Ident::new(type_name, Span::call_site());
139+
let is_syntax_tree_variant = syntax_tree_variants.contains(type_name.as_str());
140+
150141
let cfg_features = cfg::features(&node.features, "extra-traits");
151142
let body = expand_impl_body(defs, node, syntax_tree_variants);
152143
let formatter = match &node.data {
153144
Data::Enum(variants) if variants.is_empty() => quote!(_formatter),
154145
_ => quote!(formatter),
155146
};
156147

157-
quote! {
158-
#cfg_features
159-
impl Debug for crate::#ident {
160-
fn fmt(&self, #formatter: &mut fmt::Formatter) -> fmt::Result {
161-
#body
148+
if is_syntax_tree_variant {
149+
let inherent_cfg_features = cfg::features(&node.features, DocCfg::None);
150+
quote! {
151+
#cfg_features
152+
impl Debug for crate::#ident {
153+
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
154+
self.debug(formatter, #type_name)
155+
}
156+
}
157+
#inherent_cfg_features
158+
impl crate::#ident {
159+
fn debug(&self, #formatter: &mut fmt::Formatter, name: &str) -> fmt::Result {
160+
#body
161+
}
162+
}
163+
}
164+
} else {
165+
quote! {
166+
#cfg_features
167+
impl Debug for crate::#ident {
168+
fn fmt(&self, #formatter: &mut fmt::Formatter) -> fmt::Result {
169+
#body
170+
}
162171
}
163172
}
164173
}
@@ -185,6 +194,8 @@ pub fn generate(defs: &Definitions) -> Result<()> {
185194
file::write(
186195
DEBUG_SRC,
187196
quote! {
197+
#![allow(unknown_lints, non_local_definitions)]
198+
188199
use std::fmt::{self, Debug};
189200

190201
#impls

codegen/src/gen.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::cfg;
1+
use crate::cfg::{self, DocCfg};
22
use inflections::Inflect;
33
use proc_macro2::{Ident, Span, TokenStream};
44
use syn_codegen::{Data, Definitions, Features, Node};
@@ -27,7 +27,7 @@ pub fn traverse(
2727
let mut traits = TokenStream::new();
2828
let mut impls = TokenStream::new();
2929
for s in types {
30-
let features = cfg::features(&s.features, None);
30+
let features = cfg::features(&s.features, DocCfg::Ordinary);
3131
traits.extend(features.clone());
3232
impls.extend(features);
3333
node(&mut traits, &mut impls, &s, defs);

0 commit comments

Comments
 (0)