Skip to content

Commit 4ff1cd3

Browse files
committed
add description and rename msrv tests
1 parent f6a0437 commit 4ff1cd3

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

clippy_lints/src/casts/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ declare_clippy_lint! {
448448
#[clippy::version = "1.65.0"]
449449
pub PTR_CAST_CONSTNESS,
450450
pedantic,
451-
"TODO"
451+
"casting using `as` from and to raw pointers to change constness when specialized methods apply"
452452
}
453453

454454
declare_clippy_lint! {

clippy_lints/src/casts/ptr_cast_constness.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
use clippy_utils::msrvs::POINTER_CAST_CONSTNESS;
12
use clippy_utils::sugg::Sugg;
23
use clippy_utils::{diagnostics::span_lint_and_sugg, msrvs::Msrv};
34
use if_chain::if_chain;
45
use rustc_errors::Applicability;
56
use rustc_hir::{Expr, Mutability};
67
use rustc_lint::LateContext;
78
use rustc_middle::ty::{self, Ty, TypeAndMut};
8-
use rustc_semver::RustcVersion;
99

1010
use super::PTR_CAST_CONSTNESS;
1111

@@ -18,7 +18,7 @@ pub(super) fn check(
1818
msrv: &Msrv,
1919
) {
2020
if_chain! {
21-
if msrv.meets(RustcVersion::new(1,65,0));
21+
if msrv.meets(POINTER_CAST_CONSTNESS);
2222
if let ty::RawPtr(TypeAndMut { mutbl: from_mutbl, .. }) = cast_from.kind();
2323
if let ty::RawPtr(TypeAndMut { mutbl: to_mutbl, .. }) = cast_to.kind();
2424
if matches!((from_mutbl, to_mutbl),

clippy_utils/src/msrvs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ macro_rules! msrv_aliases {
2020
// names may refer to stabilized feature flags or library items
2121
msrv_aliases! {
2222
1,68,0 { PATH_MAIN_SEPARATOR_STR }
23-
1,65,0 { LET_ELSE }
23+
1,65,0 { LET_ELSE, POINTER_CAST_CONSTNESS }
2424
1,62,0 { BOOL_THEN_SOME, DEFAULT_ENUM_ATTRIBUTE }
2525
1,58,0 { FORMAT_ARGS_CAPTURE, PATTERN_TRAIT_CHAR_ARRAY }
2626
1,55,0 { SEEK_REWIND }

tests/ui/ptr_cast_constness.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn main() {
3636
}
3737

3838
#[clippy::msrv = "1.64"]
39-
fn _msrv_1_37() {
39+
fn _msrv_1_64() {
4040
let ptr: *const u32 = &42_u32;
4141
let mut_ptr: *mut u32 = &mut 42_u32;
4242

@@ -46,7 +46,7 @@ fn _msrv_1_37() {
4646
}
4747

4848
#[clippy::msrv = "1.65"]
49-
fn _msrv_1_38() {
49+
fn _msrv_1_65() {
5050
let ptr: *const u32 = &42_u32;
5151
let mut_ptr: *mut u32 = &mut 42_u32;
5252

tests/ui/ptr_cast_constness.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn main() {
3636
}
3737

3838
#[clippy::msrv = "1.64"]
39-
fn _msrv_1_37() {
39+
fn _msrv_1_64() {
4040
let ptr: *const u32 = &42_u32;
4141
let mut_ptr: *mut u32 = &mut 42_u32;
4242

@@ -46,7 +46,7 @@ fn _msrv_1_37() {
4646
}
4747

4848
#[clippy::msrv = "1.65"]
49-
fn _msrv_1_38() {
49+
fn _msrv_1_65() {
5050
let ptr: *const u32 = &42_u32;
5151
let mut_ptr: *mut u32 = &mut 42_u32;
5252

0 commit comments

Comments
 (0)