Skip to content

Commit 9b7ab1d

Browse files
committed
checked-conversions: make lint adhere to lint message convention
1 parent 40416c0 commit 9b7ab1d

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

clippy_lints/src/checked_conversions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'tcx> LateLintPass<'tcx> for CheckedConversions {
6666
cx,
6767
CHECKED_CONVERSIONS,
6868
item.span,
69-
"Checked cast can be simplified.",
69+
"checked cast can be simplified",
7070
"try",
7171
format!("{}::try_from({}).is_ok()", to_type, snippet),
7272
applicability,

tests/ui/checked_conversions.stderr

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,96 @@
1-
error: Checked cast can be simplified.
1+
error: checked cast can be simplified
22
--> $DIR/checked_conversions.rs:17:13
33
|
44
LL | let _ = value <= (u32::max_value() as i64) && value >= 0;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u32::try_from(value).is_ok()`
66
|
77
= note: `-D clippy::checked-conversions` implied by `-D warnings`
88

9-
error: Checked cast can be simplified.
9+
error: checked cast can be simplified
1010
--> $DIR/checked_conversions.rs:18:13
1111
|
1212
LL | let _ = value <= (u32::MAX as i64) && value >= 0;
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u32::try_from(value).is_ok()`
1414

15-
error: Checked cast can be simplified.
15+
error: checked cast can be simplified
1616
--> $DIR/checked_conversions.rs:22:13
1717
|
1818
LL | let _ = value <= i64::from(u16::max_value()) && value >= 0;
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u16::try_from(value).is_ok()`
2020

21-
error: Checked cast can be simplified.
21+
error: checked cast can be simplified
2222
--> $DIR/checked_conversions.rs:23:13
2323
|
2424
LL | let _ = value <= i64::from(u16::MAX) && value >= 0;
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u16::try_from(value).is_ok()`
2626

27-
error: Checked cast can be simplified.
27+
error: checked cast can be simplified
2828
--> $DIR/checked_conversions.rs:27:13
2929
|
3030
LL | let _ = value <= (u8::max_value() as isize) && value >= 0;
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u8::try_from(value).is_ok()`
3232

33-
error: Checked cast can be simplified.
33+
error: checked cast can be simplified
3434
--> $DIR/checked_conversions.rs:28:13
3535
|
3636
LL | let _ = value <= (u8::MAX as isize) && value >= 0;
3737
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u8::try_from(value).is_ok()`
3838

39-
error: Checked cast can be simplified.
39+
error: checked cast can be simplified
4040
--> $DIR/checked_conversions.rs:34:13
4141
|
4242
LL | let _ = value <= (i32::max_value() as i64) && value >= (i32::min_value() as i64);
4343
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i32::try_from(value).is_ok()`
4444

45-
error: Checked cast can be simplified.
45+
error: checked cast can be simplified
4646
--> $DIR/checked_conversions.rs:35:13
4747
|
4848
LL | let _ = value <= (i32::MAX as i64) && value >= (i32::MIN as i64);
4949
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i32::try_from(value).is_ok()`
5050

51-
error: Checked cast can be simplified.
51+
error: checked cast can be simplified
5252
--> $DIR/checked_conversions.rs:39:13
5353
|
5454
LL | let _ = value <= i64::from(i16::max_value()) && value >= i64::from(i16::min_value());
5555
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i16::try_from(value).is_ok()`
5656

57-
error: Checked cast can be simplified.
57+
error: checked cast can be simplified
5858
--> $DIR/checked_conversions.rs:40:13
5959
|
6060
LL | let _ = value <= i64::from(i16::MAX) && value >= i64::from(i16::MIN);
6161
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i16::try_from(value).is_ok()`
6262

63-
error: Checked cast can be simplified.
63+
error: checked cast can be simplified
6464
--> $DIR/checked_conversions.rs:46:13
6565
|
6666
LL | let _ = value <= i32::max_value() as u32;
6767
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i32::try_from(value).is_ok()`
6868

69-
error: Checked cast can be simplified.
69+
error: checked cast can be simplified
7070
--> $DIR/checked_conversions.rs:47:13
7171
|
7272
LL | let _ = value <= i32::MAX as u32;
7373
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i32::try_from(value).is_ok()`
7474

75-
error: Checked cast can be simplified.
75+
error: checked cast can be simplified
7676
--> $DIR/checked_conversions.rs:51:13
7777
|
7878
LL | let _ = value <= isize::max_value() as usize && value as i32 == 5;
7979
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `isize::try_from(value).is_ok()`
8080

81-
error: Checked cast can be simplified.
81+
error: checked cast can be simplified
8282
--> $DIR/checked_conversions.rs:52:13
8383
|
8484
LL | let _ = value <= isize::MAX as usize && value as i32 == 5;
8585
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `isize::try_from(value).is_ok()`
8686

87-
error: Checked cast can be simplified.
87+
error: checked cast can be simplified
8888
--> $DIR/checked_conversions.rs:56:13
8989
|
9090
LL | let _ = value <= u16::max_value() as u32 && value as i32 == 5;
9191
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u16::try_from(value).is_ok()`
9292

93-
error: Checked cast can be simplified.
93+
error: checked cast can be simplified
9494
--> $DIR/checked_conversions.rs:57:13
9595
|
9696
LL | let _ = value <= u16::MAX as u32 && value as i32 == 5;

0 commit comments

Comments
 (0)