@@ -9,7 +9,6 @@ mod cast_possible_truncation;
99mod cast_possible_wrap;
1010mod cast_precision_loss;
1111mod cast_ptr_alignment;
12- mod cast_ref_to_mut;
1312mod cast_sign_loss;
1413mod cast_slice_different_sizes;
1514mod cast_slice_from_raw_parts;
@@ -331,41 +330,6 @@ declare_clippy_lint! {
331330 "casting a function pointer to any integer type"
332331}
333332
334- declare_clippy_lint ! {
335- /// ### What it does
336- /// Checks for casts of `&T` to `&mut T` anywhere in the code.
337- ///
338- /// ### Why is this bad?
339- /// It’s basically guaranteed to be undefined behavior.
340- /// `UnsafeCell` is the only way to obtain aliasable data that is considered
341- /// mutable.
342- ///
343- /// ### Example
344- /// ```rust,ignore
345- /// fn x(r: &i32) {
346- /// unsafe {
347- /// *(r as *const _ as *mut _) += 1;
348- /// }
349- /// }
350- /// ```
351- ///
352- /// Instead consider using interior mutability types.
353- ///
354- /// ```rust
355- /// use std::cell::UnsafeCell;
356- ///
357- /// fn x(r: &UnsafeCell<i32>) {
358- /// unsafe {
359- /// *r.get() += 1;
360- /// }
361- /// }
362- /// ```
363- #[ clippy:: version = "1.33.0" ]
364- pub CAST_REF_TO_MUT ,
365- correctness,
366- "a cast of reference to a mutable pointer"
367- }
368-
369333declare_clippy_lint ! {
370334 /// ### What it does
371335 /// Checks for expressions where a character literal is cast
@@ -709,7 +673,6 @@ impl_lint_pass!(Casts => [
709673 CAST_POSSIBLE_TRUNCATION ,
710674 CAST_POSSIBLE_WRAP ,
711675 CAST_LOSSLESS ,
712- CAST_REF_TO_MUT ,
713676 CAST_PTR_ALIGNMENT ,
714677 CAST_SLICE_DIFFERENT_SIZES ,
715678 UNNECESSARY_CAST ,
@@ -778,7 +741,6 @@ impl<'tcx> LateLintPass<'tcx> for Casts {
778741 }
779742 }
780743
781- cast_ref_to_mut:: check ( cx, expr) ;
782744 cast_ptr_alignment:: check ( cx, expr) ;
783745 char_lit_as_u8:: check ( cx, expr) ;
784746 ptr_as_ptr:: check ( cx, expr, & self . msrv ) ;
0 commit comments