Skip to content

Commit

Permalink
add basic docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bend-n committed Feb 12, 2025
1 parent 409e372 commit 79f53d2
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4952,7 +4952,22 @@ declare_lint! {
}

declare_lint! {
/// Wow such docs.
/// The `redundant_transmutation` lint detects transmutations that have safer alternatives.
///
/// ### Example
///
/// ```
/// fn bytes_at_home(x: [u8; 4]) -> u32 {
/// transmute(x)
/// }
/// ```
///
/// {{produces}}
///
/// ## Explanation
///
/// People dont realize that safer methods such as [`u32::to_ne_bytes`] exist,
/// so this lint exists to lint on cases where people write transmutes that dont need to be there.
pub REDUNDANT_TRANSMUTATION,
Warn,
"detects transmutes that are shadowed by std methods"
Expand Down

0 comments on commit 79f53d2

Please sign in to comment.