@@ -9,7 +9,6 @@ mod cast_possible_truncation;
9
9
mod cast_possible_wrap;
10
10
mod cast_precision_loss;
11
11
mod cast_ptr_alignment;
12
- mod cast_ref_to_mut;
13
12
mod cast_sign_loss;
14
13
mod cast_slice_different_sizes;
15
14
mod cast_slice_from_raw_parts;
@@ -331,41 +330,6 @@ declare_clippy_lint! {
331
330
"casting a function pointer to any integer type"
332
331
}
333
332
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
-
369
333
declare_clippy_lint ! {
370
334
/// ### What it does
371
335
/// Checks for expressions where a character literal is cast
@@ -709,7 +673,6 @@ impl_lint_pass!(Casts => [
709
673
CAST_POSSIBLE_TRUNCATION ,
710
674
CAST_POSSIBLE_WRAP ,
711
675
CAST_LOSSLESS ,
712
- CAST_REF_TO_MUT ,
713
676
CAST_PTR_ALIGNMENT ,
714
677
CAST_SLICE_DIFFERENT_SIZES ,
715
678
UNNECESSARY_CAST ,
@@ -778,7 +741,6 @@ impl<'tcx> LateLintPass<'tcx> for Casts {
778
741
}
779
742
}
780
743
781
- cast_ref_to_mut:: check ( cx, expr) ;
782
744
cast_ptr_alignment:: check ( cx, expr) ;
783
745
char_lit_as_u8:: check ( cx, expr) ;
784
746
ptr_as_ptr:: check ( cx, expr, & self . msrv ) ;
0 commit comments