From 477254f27cacd8b1bda8e2545fec9540bd9eb94f Mon Sep 17 00:00:00 2001 From: Yuki Sireneva Date: Tue, 22 Oct 2024 11:13:30 +0300 Subject: [PATCH] silence another warning warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item --> src/linux/entry.rs:223:10 | 223 | #[derive(Deserialize_enum)] | ^^^^^^^^^^^^^^^^ | | | `__Command_Bind_Struct` is not local | `Deserialize` is not local | move the `impl` block outside of this constant `_` and up 2 bodies | = note: the derive macro `Deserialize_enum` defines the non-local `impl`, and may need to be changed = note: the derive macro `Deserialize_enum` may come from an old version of the `miniserde_enum` crate, try updating your dependency with `cargo update -p miniserde_enum` = 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: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration for the purpose of this lint = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the derive macro `Deserialize_enum` (in Nightly builds, run with -Z macro-backtrace for more info) --- src/de.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/de.rs b/src/de.rs index efaa565..5d4cae1 100644 --- a/src/de.rs +++ b/src/de.rs @@ -99,6 +99,7 @@ pub fn deserialize_internal( let ex = quote!(std::prelude::v1); Ok(quote! { + #[expect(non_local_definitions)] const _: () = { #[repr(transparent)] struct __Visitor { @@ -196,6 +197,7 @@ pub fn deserialize_adjacent( let ex = quote!(std::prelude::v1); Ok(quote! { + #[expect(non_local_definitions)] const _: () = { #[repr(transparent)] struct __Visitor { @@ -290,6 +292,7 @@ pub fn deserialize_external(input: &DeriveInput, enumeration: &DataEnum) -> Resu let ex = quote!(std::prelude::v1); Ok(quote! { + #[expect(non_local_definitions)] const _: () = { struct __Visitor #impl_generics #where_clause { __out: #ex::Option<#ident #ty_generics>,