Skip to content

Commit 48fffe7

Browse files
authored
add a preferred fix for cast_possible_wrap description (rust-lang#14225)
close rust-lang#9250 changelog: none
2 parents f49b4bc + a12d5a0 commit 48fffe7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

clippy_lints/src/casts/mod.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,14 @@ declare_clippy_lint! {
134134
///
135135
/// ### Example
136136
/// ```no_run
137-
/// u32::MAX as i32; // will yield a value of `-1`
137+
/// let _ = u32::MAX as i32; // will yield a value of `-1`
138138
/// ```
139+
///
140+
/// Use instead:
141+
/// ```no_run
142+
/// let _ = i32::try_from(u32::MAX).ok();
143+
/// ```
144+
///
139145
#[clippy::version = "pre 1.29.0"]
140146
pub CAST_POSSIBLE_WRAP,
141147
pedantic,

0 commit comments

Comments
 (0)