Closed
Description
clippy::unsafe_derive_deserialize
can't be allowed/warned/denied by outer attributes on the struct or its impls. Minor inconvenience but might be worth making one of these allow
s functional?
#![allow(dead_code, unused_unsafe)]
#![warn(clippy::unsafe_derive_deserialize)]
use serde::Deserialize;
#[allow(clippy::unsafe_derive_deserialize)]
#[derive(Deserialize)]
struct Foo;
#[allow(clippy::unsafe_derive_deserialize)]
impl Foo {
fn bar(&mut self) {
let _ = self;
unsafe {}
}
}
Clippy:
Checking playground v0.0.1 (/playground)
warning: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
--> src/lib.rs:7:10
|
7 | #[derive(Deserialize)]
| ^^^^^^^^^^^
|
note: the lint level is defined here
--> src/lib.rs:2:9
|
2 | #![warn(clippy::unsafe_derive_deserialize)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: consider implementing `serde::Deserialize` manually. See https://serde.rs/impl-deserialize.html
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unsafe_derive_deserialize
= note: this warning originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)