Skip to content

Commit 79f53d2

Browse files
committed
add basic docs
1 parent 409e372 commit 79f53d2

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

compiler/rustc_lint_defs/src/builtin.rs

+16-1
Original file line numberDiff line numberDiff line change
@@ -4952,7 +4952,22 @@ declare_lint! {
49524952
}
49534953

49544954
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.
49564971
pub REDUNDANT_TRANSMUTATION,
49574972
Warn,
49584973
"detects transmutes that are shadowed by std methods"

0 commit comments

Comments
 (0)