Skip to content

Commit 4726daa

Browse files
committed
Use int assoc consts in checked_conversions lint
1 parent b192f2c commit 4726daa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clippy_lints/src/checked_conversions.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ declare_clippy_lint! {
2121
/// ```rust
2222
/// # let foo: u32 = 5;
2323
/// # let _ =
24-
/// foo <= i32::max_value() as u32
24+
/// foo <= i32::MAX as u32
2525
/// # ;
2626
/// ```
2727
///
@@ -179,7 +179,7 @@ impl ConversionType {
179179
}
180180
}
181181

182-
/// Check for `expr <= (to_type::max_value() as from_type)`
182+
/// Check for `expr <= (to_type::MAX as from_type)`
183183
fn check_upper_bound<'tcx>(expr: &'tcx Expr<'tcx>) -> Option<Conversion<'tcx>> {
184184
if_chain! {
185185
if let ExprKind::Binary(ref op, ref left, ref right) = &expr.kind;
@@ -194,7 +194,7 @@ fn check_upper_bound<'tcx>(expr: &'tcx Expr<'tcx>) -> Option<Conversion<'tcx>> {
194194
}
195195
}
196196

197-
/// Check for `expr >= 0|(to_type::min_value() as from_type)`
197+
/// Check for `expr >= 0|(to_type::MIN as from_type)`
198198
fn check_lower_bound<'tcx>(expr: &'tcx Expr<'tcx>) -> Option<Conversion<'tcx>> {
199199
fn check_function<'a>(candidate: &'a Expr<'a>, check: &'a Expr<'a>) -> Option<Conversion<'a>> {
200200
(check_lower_bound_zero(candidate, check)).or_else(|| (check_lower_bound_min(candidate, check)))
@@ -222,7 +222,7 @@ fn check_lower_bound_zero<'a>(candidate: &'a Expr<'_>, check: &'a Expr<'_>) -> O
222222
}
223223
}
224224

225-
/// Check for `expr >= (to_type::min_value() as from_type)`
225+
/// Check for `expr >= (to_type::MIN as from_type)`
226226
fn check_lower_bound_min<'a>(candidate: &'a Expr<'_>, check: &'a Expr<'_>) -> Option<Conversion<'a>> {
227227
if let Some((from, to)) = get_types_from_cast(check, MIN_VALUE, SINTS) {
228228
Conversion::try_new(candidate, from, to)

0 commit comments

Comments
 (0)