add description and rename msrv tests

This commit is contained in:
Centri3 2023-05-16 11:20:00 -05:00
parent f6a0437e74
commit 4ff1cd365d
5 changed files with 8 additions and 8 deletions

View file

@ -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! {

View file

@ -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),

View file

@ -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 }

View file

@ -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;

View file

@ -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;