rpm-rs / rpm

Other
46 stars 24 forks source link

clippy: warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item #228

Closed marxin closed 3 months ago

marxin commented 3 months ago

I noticed the following warnings with clippy that are quite hard for me to follow:

warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
  --> src/constants.rs:22:5
   |
22 |     num_derive::FromPrimitive,
   |     ^------------------------
   |     |
   |     `FromPrimitive` is not local
   |     move the `impl` block outside of this constant `_IMPL_NUM_FromPrimitive_FOR_IndexTag`
...
32 | pub enum IndexTag {
   |          -------- `IndexTag` is not local
   |
   = note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
   = note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
   = note: the derive macro `num_derive::FromPrimitive` may come from an old version of the `num_derive` crate, try updating your dependency with `cargo update -p num_derive`
   = note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
   = 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
   = note: this warning originates in the derive macro `num_derive::FromPrimitive` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
  --> src/constants.rs:23:5
   |
23 |     num_derive::ToPrimitive,
   |     ^----------------------
   |     |
   |     `ToPrimitive` is not local
   |     move the `impl` block outside of this constant `_IMPL_NUM_ToPrimitive_FOR_IndexTag`
...
32 | pub enum IndexTag {
   |          -------- `IndexTag` is not local
   |
   = note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
   = note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
   = note: the derive macro `num_derive::ToPrimitive` may come from an old version of the `num_derive` crate, try updating your dependency with `cargo update -p num_derive`
   = note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
   = 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: this warning originates in the derive macro `num_derive::ToPrimitive` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
   --> src/constants.rs:367:5
    |
367 |     num_derive::FromPrimitive,
    |     ^------------------------
    |     |
    |     `FromPrimitive` is not local
    |     move the `impl` block outside of this constant `_IMPL_NUM_FromPrimitive_FOR_IndexSignatureTag`
...
377 | pub enum IndexSignatureTag {
    |          ----------------- `IndexSignatureTag` is not local
    |
    = note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
    = note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
    = note: the derive macro `num_derive::FromPrimitive` may come from an old version of the `num_derive` crate, try updating your dependency with `cargo update -p num_derive`
    = note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
    = 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: this warning originates in the derive macro `num_derive::FromPrimitive` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
   --> src/constants.rs:368:5
    |
368 |     num_derive::ToPrimitive,
    |     ^----------------------
    |     |
    |     `ToPrimitive` is not local
    |     move the `impl` block outside of this constant `_IMPL_NUM_ToPrimitive_FOR_IndexSignatureTag`
...
377 | pub enum IndexSignatureTag {
    |          ----------------- `IndexSignatureTag` is not local
    |
    = note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
    = note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
    = note: the derive macro `num_derive::ToPrimitive` may come from an old version of the `num_derive` crate, try updating your dependency with `cargo update -p num_derive`
    = note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
    = 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: this warning originates in the derive macro `num_derive::ToPrimitive` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: `rpm` (lib) generated 4 warnings
marxin commented 3 months ago

May I ask you why did you close this? It's not addressed yet, right?