We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 409e372 commit 79f53d2Copy full SHA for 79f53d2
compiler/rustc_lint_defs/src/builtin.rs
@@ -4952,7 +4952,22 @@ declare_lint! {
4952
}
4953
4954
declare_lint! {
4955
- /// Wow such docs.
+ /// The `redundant_transmutation` lint detects transmutations that have safer alternatives.
4956
+ ///
4957
+ /// ### Example
4958
4959
+ /// ```
4960
+ /// fn bytes_at_home(x: [u8; 4]) -> u32 {
4961
+ /// transmute(x)
4962
+ /// }
4963
4964
4965
+ /// {{produces}}
4966
4967
+ /// ## Explanation
4968
4969
+ /// People dont realize that safer methods such as [`u32::to_ne_bytes`] exist,
4970
+ /// so this lint exists to lint on cases where people write transmutes that dont need to be there.
4971
pub REDUNDANT_TRANSMUTATION,
4972
Warn,
4973
"detects transmutes that are shadowed by std methods"
0 commit comments