mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
add test for #[expect]
ing unsafe_derive_deserialize
Adding `#![feature(lint_reasons)]` to the top of the file also changed the line numbers in the expected error output.
This commit is contained in:
parent
fc2f7035c6
commit
1b6c91628e
2 changed files with 15 additions and 4 deletions
|
@ -1,3 +1,4 @@
|
|||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::unsafe_derive_deserialize)]
|
||||
#![allow(unused, clippy::missing_safety_doc)]
|
||||
|
||||
|
@ -71,4 +72,14 @@ impl G {
|
|||
}
|
||||
}
|
||||
|
||||
// Check that we honor the `expect` attribute on the ADT
|
||||
#[expect(clippy::unsafe_derive_deserialize)]
|
||||
#[derive(Deserialize)]
|
||||
pub struct H;
|
||||
impl H {
|
||||
pub fn unsafe_block(&self) {
|
||||
unsafe {}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:8:10
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:9:10
|
||||
|
|
||||
LL | #[derive(Deserialize)]
|
||||
| ^^^^^^^^^^^
|
||||
|
@ -10,7 +10,7 @@ LL | #[derive(Deserialize)]
|
|||
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:17:10
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:18:10
|
||||
|
|
||||
LL | #[derive(Deserialize)]
|
||||
| ^^^^^^^^^^^
|
||||
|
@ -19,7 +19,7 @@ LL | #[derive(Deserialize)]
|
|||
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:24:10
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:25:10
|
||||
|
|
||||
LL | #[derive(Deserialize)]
|
||||
| ^^^^^^^^^^^
|
||||
|
@ -28,7 +28,7 @@ LL | #[derive(Deserialize)]
|
|||
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:33:10
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:34:10
|
||||
|
|
||||
LL | #[derive(Deserialize)]
|
||||
| ^^^^^^^^^^^
|
||||
|
|
Loading…
Reference in a new issue