add a preferred fix for cast_possible_wrap description (#14225)

close #9250

changelog: none
This commit is contained in:
Alejandra González
2025-02-18 23:47:57 +00:00
committed by GitHub
+7 -1
View File
@@ -134,8 +134,14 @@
///
/// ### Example
/// ```no_run
/// u32::MAX as i32; // will yield a value of `-1`
/// let _ = u32::MAX as i32; // will yield a value of `-1`
/// ```
///
/// Use instead:
/// ```no_run
/// let _ = i32::try_from(u32::MAX).ok();
/// ```
///
#[clippy::version = "pre 1.29.0"]
pub CAST_POSSIBLE_WRAP,
pedantic,