We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
cast_possible_wrap
1 parent 8cef0b6 commit a12d5a0Copy full SHA for a12d5a0
clippy_lints/src/casts/mod.rs
@@ -134,8 +134,14 @@ declare_clippy_lint! {
134
///
135
/// ### Example
136
/// ```no_run
137
- /// u32::MAX as i32; // will yield a value of `-1`
+ /// let _ = u32::MAX as i32; // will yield a value of `-1`
138
/// ```
139
+ ///
140
+ /// Use instead:
141
+ /// ```no_run
142
+ /// let _ = i32::try_from(u32::MAX).ok();
143
+ /// ```
144
145
#[clippy::version = "pre 1.29.0"]
146
pub CAST_POSSIBLE_WRAP,
147
pedantic,
0 commit comments