File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
compiler/rustc_lint_defs/src Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -4952,7 +4952,22 @@ declare_lint! {
4952
4952
}
4953
4953
4954
4954
declare_lint ! {
4955
- /// Wow such docs.
4955
+ /// 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.
4956
4971
pub REDUNDANT_TRANSMUTATION ,
4957
4972
Warn ,
4958
4973
"detects transmutes that are shadowed by std methods"
You can’t perform that action at this time.
0 commit comments