Skip to content

Commit 1a5db18

Browse files
committed
Drop uplifted clippy::cast_ref_to_mut
1 parent a3ff2b9 commit 1a5db18

9 files changed

+61
-168
lines changed

clippy_lints/src/casts/cast_ref_to_mut.rs

-26
This file was deleted.

clippy_lints/src/casts/mod.rs

-38
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ mod cast_possible_truncation;
99
mod cast_possible_wrap;
1010
mod cast_precision_loss;
1111
mod cast_ptr_alignment;
12-
mod cast_ref_to_mut;
1312
mod cast_sign_loss;
1413
mod cast_slice_different_sizes;
1514
mod cast_slice_from_raw_parts;
@@ -330,41 +329,6 @@ declare_clippy_lint! {
330329
"casting a function pointer to any integer type"
331330
}
332331

333-
declare_clippy_lint! {
334-
/// ### What it does
335-
/// Checks for casts of `&T` to `&mut T` anywhere in the code.
336-
///
337-
/// ### Why is this bad?
338-
/// It’s basically guaranteed to be undefined behavior.
339-
/// `UnsafeCell` is the only way to obtain aliasable data that is considered
340-
/// mutable.
341-
///
342-
/// ### Example
343-
/// ```rust,ignore
344-
/// fn x(r: &i32) {
345-
/// unsafe {
346-
/// *(r as *const _ as *mut _) += 1;
347-
/// }
348-
/// }
349-
/// ```
350-
///
351-
/// Instead consider using interior mutability types.
352-
///
353-
/// ```rust
354-
/// use std::cell::UnsafeCell;
355-
///
356-
/// fn x(r: &UnsafeCell<i32>) {
357-
/// unsafe {
358-
/// *r.get() += 1;
359-
/// }
360-
/// }
361-
/// ```
362-
#[clippy::version = "1.33.0"]
363-
pub CAST_REF_TO_MUT,
364-
correctness,
365-
"a cast of reference to a mutable pointer"
366-
}
367-
368332
declare_clippy_lint! {
369333
/// ### What it does
370334
/// Checks for expressions where a character literal is cast
@@ -680,7 +644,6 @@ impl_lint_pass!(Casts => [
680644
CAST_POSSIBLE_TRUNCATION,
681645
CAST_POSSIBLE_WRAP,
682646
CAST_LOSSLESS,
683-
CAST_REF_TO_MUT,
684647
CAST_PTR_ALIGNMENT,
685648
CAST_SLICE_DIFFERENT_SIZES,
686649
UNNECESSARY_CAST,
@@ -747,7 +710,6 @@ impl<'tcx> LateLintPass<'tcx> for Casts {
747710
}
748711
}
749712

750-
cast_ref_to_mut::check(cx, expr);
751713
cast_ptr_alignment::check(cx, expr);
752714
char_lit_as_u8::check(cx, expr);
753715
ptr_as_ptr::check(cx, expr, &self.msrv);

clippy_lints/src/declared_lints.rs

-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
8181
crate::casts::CAST_POSSIBLE_WRAP_INFO,
8282
crate::casts::CAST_PRECISION_LOSS_INFO,
8383
crate::casts::CAST_PTR_ALIGNMENT_INFO,
84-
crate::casts::CAST_REF_TO_MUT_INFO,
8584
crate::casts::CAST_SIGN_LOSS_INFO,
8685
crate::casts::CAST_SLICE_DIFFERENT_SIZES_INFO,
8786
crate::casts::CAST_SLICE_FROM_RAW_PARTS_INFO,

clippy_lints/src/renamed_lints.rs

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[
3131
("clippy::stutter", "clippy::module_name_repetitions"),
3232
("clippy::to_string_in_display", "clippy::recursive_format_impl"),
3333
("clippy::zero_width_space", "clippy::invisible_characters"),
34+
("clippy::cast_ref_to_mut", "cast_ref_to_mut"),
3435
("clippy::clone_double_ref", "suspicious_double_ref_op"),
3536
("clippy::drop_bounds", "drop_bounds"),
3637
("clippy::drop_copy", "dropping_copy_types"),

tests/ui/cast_ref_to_mut.rs

-31
This file was deleted.

tests/ui/cast_ref_to_mut.stderr

-22
This file was deleted.

tests/ui/rename.fixed

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#![allow(clippy::recursive_format_impl)]
3030
#![allow(clippy::invisible_characters)]
3131
#![allow(suspicious_double_ref_op)]
32+
#![allow(cast_ref_to_mut)]
3233
#![allow(drop_bounds)]
3334
#![allow(dropping_copy_types)]
3435
#![allow(dropping_references)]
@@ -76,6 +77,7 @@
7677
#![warn(clippy::module_name_repetitions)]
7778
#![warn(clippy::recursive_format_impl)]
7879
#![warn(clippy::invisible_characters)]
80+
#![warn(cast_ref_to_mut)]
7981
#![warn(suspicious_double_ref_op)]
8082
#![warn(drop_bounds)]
8183
#![warn(dropping_copy_types)]

tests/ui/rename.rs

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#![allow(clippy::recursive_format_impl)]
3030
#![allow(clippy::invisible_characters)]
3131
#![allow(suspicious_double_ref_op)]
32+
#![allow(cast_ref_to_mut)]
3233
#![allow(drop_bounds)]
3334
#![allow(dropping_copy_types)]
3435
#![allow(dropping_references)]
@@ -76,6 +77,7 @@
7677
#![warn(clippy::stutter)]
7778
#![warn(clippy::to_string_in_display)]
7879
#![warn(clippy::zero_width_space)]
80+
#![warn(clippy::cast_ref_to_mut)]
7981
#![warn(clippy::clone_double_ref)]
8082
#![warn(clippy::drop_bounds)]
8183
#![warn(clippy::drop_copy)]

0 commit comments

Comments
 (0)