Skip to content

Commit

Permalink
Resolve non_local_definitions warning in debug impls
Browse files Browse the repository at this point in the history
    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 | |         }
         | |_________^
         |
     …
  • Loading branch information
dtolnay committed Feb 26, 2024
1 parent 8667ad9 commit 7e0d4e1
Show file tree
Hide file tree
Showing 5 changed files with 1,300 additions and 1,194 deletions.
32 changes: 22 additions & 10 deletions codegen/src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,40 @@ use proc_macro2::TokenStream;
use quote::quote;
use syn_codegen::Features;

pub fn features<'a>(
features: &Features,
overriding_cfg: impl Into<Option<&'a str>>,
) -> TokenStream {
pub enum DocCfg {
Ordinary,
Override(&'static str),
None,
}

impl From<&'static str> for DocCfg {
fn from(overriding_cfg: &'static str) -> Self {
DocCfg::Override(overriding_cfg)
}
}

pub fn features(features: &Features, doc_cfg: impl Into<DocCfg>) -> TokenStream {
let features = &features.any;
let cfg = match features.len() {
0 => None,
1 => Some(quote! { cfg(feature = #(#features)*) }),
_ => Some(quote! { cfg(any(#(feature = #features),*)) }),
};
match (cfg, overriding_cfg.into()) {
(Some(cfg), Some(overriding_cfg)) => quote! {
match (cfg, doc_cfg.into()) {
(Some(cfg), DocCfg::Ordinary) => quote! {
#[#cfg]
#[cfg_attr(doc_cfg, doc(#cfg))]
},
(Some(cfg), DocCfg::Override(overriding_cfg)) => quote! {
#[#cfg]
#[cfg_attr(doc_cfg, doc(cfg(feature = #overriding_cfg)))]
},
(Some(cfg), None) => quote! {
(Some(cfg), DocCfg::None) => quote! {
#[#cfg]
#[cfg_attr(doc_cfg, doc(#cfg))]
},
(None, Some(overriding_cfg)) => quote! {
(None, DocCfg::Override(overriding_cfg)) => quote! {
#[cfg_attr(doc_cfg, doc(cfg(feature = #overriding_cfg)))]
},
(None, None) => TokenStream::new(),
(None, DocCfg::Ordinary | DocCfg::None) => TokenStream::new(),
}
}
53 changes: 32 additions & 21 deletions codegen/src/debug.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::{cfg, file, lookup};
use crate::cfg::{self, DocCfg};
use crate::{file, lookup};
use anyhow::Result;
use proc_macro2::{Ident, Span, TokenStream};
use quote::{format_ident, quote};
Expand Down Expand Up @@ -49,7 +50,7 @@ fn expand_impl_body(
let ident = Ident::new(type_name, Span::call_site());
let is_syntax_tree_variant = syntax_tree_variants.contains(type_name.as_str());

let body = match &node.data {
match &node.data {
Data::Enum(variants) if variants.is_empty() => quote!(match *self {}),
Data::Enum(variants) => {
assert!(!is_syntax_tree_variant);
Expand Down Expand Up @@ -124,19 +125,6 @@ fn expand_impl_body(
}
}
Data::Private => unreachable!(),
};

if is_syntax_tree_variant {
quote! {
impl crate::#ident {
fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result {
#body
}
}
self.debug(formatter, #type_name)
}
} else {
body
}
}

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

let ident = Ident::new(&node.ident, Span::call_site());
let type_name = &node.ident;
let ident = Ident::new(type_name, Span::call_site());
let is_syntax_tree_variant = syntax_tree_variants.contains(type_name.as_str());

let cfg_features = cfg::features(&node.features, "extra-traits");
let body = expand_impl_body(defs, node, syntax_tree_variants);
let formatter = match &node.data {
Data::Enum(variants) if variants.is_empty() => quote!(_formatter),
_ => quote!(formatter),
};

quote! {
#cfg_features
impl Debug for crate::#ident {
fn fmt(&self, #formatter: &mut fmt::Formatter) -> fmt::Result {
#body
if is_syntax_tree_variant {
let inherent_cfg_features = cfg::features(&node.features, DocCfg::None);
quote! {
#cfg_features
impl Debug for crate::#ident {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
self.debug(formatter, #type_name)
}
}
#inherent_cfg_features
impl crate::#ident {
fn debug(&self, #formatter: &mut fmt::Formatter, name: &str) -> fmt::Result {
#body
}
}
}
} else {
quote! {
#cfg_features
impl Debug for crate::#ident {
fn fmt(&self, #formatter: &mut fmt::Formatter) -> fmt::Result {
#body
}
}
}
}
Expand All @@ -185,6 +194,8 @@ pub fn generate(defs: &Definitions) -> Result<()> {
file::write(
DEBUG_SRC,
quote! {
#![allow(unknown_lints, non_local_definitions)]

use std::fmt::{self, Debug};

#impls
Expand Down
4 changes: 2 additions & 2 deletions codegen/src/gen.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::cfg;
use crate::cfg::{self, DocCfg};
use inflections::Inflect;
use proc_macro2::{Ident, Span, TokenStream};
use syn_codegen::{Data, Definitions, Features, Node};
Expand Down Expand Up @@ -27,7 +27,7 @@ pub fn traverse(
let mut traits = TokenStream::new();
let mut impls = TokenStream::new();
for s in types {
let features = cfg::features(&s.features, None);
let features = cfg::features(&s.features, DocCfg::Ordinary);
traits.extend(features.clone());
impls.extend(features);
node(&mut traits, &mut impls, &s, defs);
Expand Down
Loading

0 comments on commit 7e0d4e1

Please sign in to comment.