diff options
| author | Centri3 <114838443+Centri3@users.noreply.github.com> | 2023-05-16 11:20:00 -0500 |
|---|---|---|
| committer | Centri3 <114838443+Centri3@users.noreply.github.com> | 2023-05-16 11:20:00 -0500 |
| commit | 4ff1cd365df96c4d0aef5b899ac248ff11799c36 (patch) | |
| tree | 51ed9d59034d7a499fede3eee01c5d4ee6c4aac9 | |
| parent | f6a0437e74494b3f887286540333abfc691055b4 (diff) | |
| download | rust-4ff1cd365df96c4d0aef5b899ac248ff11799c36.tar.gz rust-4ff1cd365df96c4d0aef5b899ac248ff11799c36.zip | |
add description and rename msrv tests
| -rw-r--r-- | clippy_lints/src/casts/mod.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/casts/ptr_cast_constness.rs | 4 | ||||
| -rw-r--r-- | clippy_utils/src/msrvs.rs | 2 | ||||
| -rw-r--r-- | tests/ui/ptr_cast_constness.fixed | 4 | ||||
| -rw-r--r-- | tests/ui/ptr_cast_constness.rs | 4 |
5 files changed, 8 insertions, 8 deletions
diff --git a/clippy_lints/src/casts/mod.rs b/clippy_lints/src/casts/mod.rs index 07650bdd7b8..a2f8546d3a6 100644 --- a/clippy_lints/src/casts/mod.rs +++ b/clippy_lints/src/casts/mod.rs @@ -448,7 +448,7 @@ declare_clippy_lint! { #[clippy::version = "1.65.0"] pub PTR_CAST_CONSTNESS, pedantic, - "TODO" + "casting using `as` from and to raw pointers to change constness when specialized methods apply" } declare_clippy_lint! { diff --git a/clippy_lints/src/casts/ptr_cast_constness.rs b/clippy_lints/src/casts/ptr_cast_constness.rs index f8327b04b0f..ab015f8822e 100644 --- a/clippy_lints/src/casts/ptr_cast_constness.rs +++ b/clippy_lints/src/casts/ptr_cast_constness.rs @@ -1,3 +1,4 @@ +use clippy_utils::msrvs::POINTER_CAST_CONSTNESS; use clippy_utils::sugg::Sugg; use clippy_utils::{diagnostics::span_lint_and_sugg, msrvs::Msrv}; use if_chain::if_chain; @@ -5,7 +6,6 @@ use rustc_errors::Applicability; use rustc_hir::{Expr, Mutability}; use rustc_lint::LateContext; use rustc_middle::ty::{self, Ty, TypeAndMut}; -use rustc_semver::RustcVersion; use super::PTR_CAST_CONSTNESS; @@ -18,7 +18,7 @@ pub(super) fn check( msrv: &Msrv, ) { if_chain! { - if msrv.meets(RustcVersion::new(1,65,0)); + if msrv.meets(POINTER_CAST_CONSTNESS); if let ty::RawPtr(TypeAndMut { mutbl: from_mutbl, .. }) = cast_from.kind(); if let ty::RawPtr(TypeAndMut { mutbl: to_mutbl, .. }) = cast_to.kind(); if matches!((from_mutbl, to_mutbl), diff --git a/clippy_utils/src/msrvs.rs b/clippy_utils/src/msrvs.rs index e05de2dc99c..6f102308f0b 100644 --- a/clippy_utils/src/msrvs.rs +++ b/clippy_utils/src/msrvs.rs @@ -20,7 +20,7 @@ macro_rules! msrv_aliases { // names may refer to stabilized feature flags or library items msrv_aliases! { 1,68,0 { PATH_MAIN_SEPARATOR_STR } - 1,65,0 { LET_ELSE } + 1,65,0 { LET_ELSE, POINTER_CAST_CONSTNESS } 1,62,0 { BOOL_THEN_SOME, DEFAULT_ENUM_ATTRIBUTE } 1,58,0 { FORMAT_ARGS_CAPTURE, PATTERN_TRAIT_CHAR_ARRAY } 1,55,0 { SEEK_REWIND } diff --git a/tests/ui/ptr_cast_constness.fixed b/tests/ui/ptr_cast_constness.fixed index dc7acdae69c..24de573d083 100644 --- a/tests/ui/ptr_cast_constness.fixed +++ b/tests/ui/ptr_cast_constness.fixed @@ -36,7 +36,7 @@ fn main() { } #[clippy::msrv = "1.64"] -fn _msrv_1_37() { +fn _msrv_1_64() { let ptr: *const u32 = &42_u32; let mut_ptr: *mut u32 = &mut 42_u32; @@ -46,7 +46,7 @@ fn _msrv_1_37() { } #[clippy::msrv = "1.65"] -fn _msrv_1_38() { +fn _msrv_1_65() { let ptr: *const u32 = &42_u32; let mut_ptr: *mut u32 = &mut 42_u32; diff --git a/tests/ui/ptr_cast_constness.rs b/tests/ui/ptr_cast_constness.rs index a560d36d117..63d973a9fca 100644 --- a/tests/ui/ptr_cast_constness.rs +++ b/tests/ui/ptr_cast_constness.rs @@ -36,7 +36,7 @@ fn main() { } #[clippy::msrv = "1.64"] -fn _msrv_1_37() { +fn _msrv_1_64() { let ptr: *const u32 = &42_u32; let mut_ptr: *mut u32 = &mut 42_u32; @@ -46,7 +46,7 @@ fn _msrv_1_37() { } #[clippy::msrv = "1.65"] -fn _msrv_1_38() { +fn _msrv_1_65() { let ptr: *const u32 = &42_u32; let mut_ptr: *mut u32 = &mut 42_u32; |
