File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed
clippy_lints/src/transmute Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ declare_clippy_lint! {
5353 ///
5454 /// ```ignore
5555 /// unsafe {
56- /// std::mem::transmute::<Option<&i32>, Option<&mut i32>>(& Some(5));
56+ /// std::mem::transmute::<Option<&i32>, Option<&mut i32>>(Some(& 5));
5757 /// }
5858 /// ```
5959 #[ clippy:: version = "1.92.0" ]
@@ -492,6 +492,7 @@ impl_lint_pass!(Transmute => [
492492 USELESS_TRANSMUTE ,
493493 WRONG_TRANSMUTE ,
494494 TRANSMUTE_BYTES_TO_STR ,
495+ MUTABLE_ADT_ARGUEMENT_TRANSMUTE ,
495496 TRANSMUTE_INT_TO_BOOL ,
496497 TRANSMUTE_INT_TO_NON_ZERO ,
497498 UNSOUND_COLLECTION_TRANSMUTE ,
Original file line number Diff line number Diff line change 11#![ warn( clippy:: mutable_adt_arguement_transmute) ]
22
33fn main ( ) {
4- // test code goes here
4+ unsafe {
5+ let _: Option < & mut i32 > = std:: mem:: transmute ( Some ( & 5i32 ) ) ;
6+ //~^ mutable_adt_arguement_transmute
7+ }
58}
Original file line number Diff line number Diff line change 1+ error: transmute of type arguement &i32 to &i32
2+ --> tests/ui/mutable_adt_arguement_transmute.rs:5:35
3+ |
4+ LL | let _: Option<&mut i32> = std::mem::transmute(Some(&5i32));
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+ |
7+ = note: `-D clippy::mutable-adt-arguement-transmute` implied by `-D warnings`
8+ = help: to override `-D warnings` add `#[allow(clippy::mutable_adt_arguement_transmute)]`
9+
10+ error: aborting due to 1 previous error
11+
You can’t perform that action at this time.
0 commit comments