File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
clippy_lints/src/transmute Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -435,10 +435,11 @@ declare_clippy_lint! {
435435 /// to infer a technically correct yet unexpected type.
436436 ///
437437 /// ### Example
438- /// ```no_run
438+ /// ```
439439 /// # unsafe {
440+ /// let mut x: i32 = 0;
440441 /// // Avoid "naked" calls to `transmute()`!
441- /// let x: i32 = std::mem::transmute([1u16, 2u16]);
442+ /// x = std::mem::transmute([1u16, 2u16]);
442443 ///
443444 /// // `first_answers` is intended to transmute a slice of bool to a slice of u8.
444445 /// // But the programmer forgot to index the first element of the outer slice,
@@ -449,7 +450,7 @@ declare_clippy_lint! {
449450 /// # }
450451 /// ```
451452 /// Use instead:
452- /// ```no_run
453+ /// ```
453454 /// # unsafe {
454455 /// let x = std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]);
455456 ///
You can’t perform that action at this time.
0 commit comments