From 79f53d2dbbf5a3e6c9f833dfd8efacd335a301bc Mon Sep 17 00:00:00 2001 From: bendn Date: Thu, 13 Feb 2025 00:32:28 +0700 Subject: [PATCH] add basic docs --- compiler/rustc_lint_defs/src/builtin.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index dc9e5c7bcfc11..a207bfd6cd19a 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -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"