rust/tests/ui/manual_saturating_arithmetic.stderr

165 lines
7.3 KiB
Plaintext
Raw Normal View History

2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:6:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1u32.checked_add(1).unwrap_or(u32::max_value());
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1u32.saturating_add(1)`
2019-09-04 02:08:48 -05:00
|
= note: `-D clippy::manual-saturating-arithmetic` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::manual_saturating_arithmetic)]`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:7:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1u32.checked_add(1).unwrap_or(u32::MAX);
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1u32.saturating_add(1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:8:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1u8.checked_add(1).unwrap_or(255);
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1u8.saturating_add(1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:9:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1u128
| _____________^
LL | | .checked_add(1)
LL | | .unwrap_or(340_282_366_920_938_463_463_374_607_431_768_211_455);
2024-01-18 11:17:53 -06:00
| |_______________________________________________________________________^ help: consider using `saturating_add`: `1u128.saturating_add(1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:14:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1u32.checked_mul(1).unwrap_or(u32::MAX);
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_mul`: `1u32.saturating_mul(1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:16:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1u32.checked_sub(1).unwrap_or(u32::min_value());
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1u32.saturating_sub(1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:17:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1u32.checked_sub(1).unwrap_or(u32::MIN);
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1u32.saturating_sub(1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:18:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1u8.checked_sub(1).unwrap_or(0);
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1u8.saturating_sub(1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:22:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i32.checked_add(1).unwrap_or(i32::max_value());
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1i32.saturating_add(1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:23:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i32.checked_add(1).unwrap_or(i32::MAX);
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1i32.saturating_add(1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:24:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i8.checked_add(1).unwrap_or(127);
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1i8.saturating_add(1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:25:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i128
| _____________^
LL | | .checked_add(1)
LL | | .unwrap_or(170_141_183_460_469_231_731_687_303_715_884_105_727);
2024-01-18 11:17:53 -06:00
| |_______________________________________________________________________^ help: consider using `saturating_add`: `1i128.saturating_add(1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:28:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i32.checked_add(-1).unwrap_or(i32::min_value());
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1i32.saturating_add(-1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:29:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i32.checked_add(-1).unwrap_or(i32::MIN);
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1i32.saturating_add(-1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:30:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i8.checked_add(-1).unwrap_or(-128);
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1i8.saturating_add(-1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:31:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i128
| _____________^
LL | | .checked_add(-1)
LL | | .unwrap_or(-170_141_183_460_469_231_731_687_303_715_884_105_728);
2024-01-18 11:17:53 -06:00
| |________________________________________________________________________^ help: consider using `saturating_add`: `1i128.saturating_add(-1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:38:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i32.checked_sub(1).unwrap_or(i32::min_value());
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1i32.saturating_sub(1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:39:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i32.checked_sub(1).unwrap_or(i32::MIN);
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1i32.saturating_sub(1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:40:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i8.checked_sub(1).unwrap_or(-128);
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1i8.saturating_sub(1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:41:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i128
| _____________^
LL | | .checked_sub(1)
LL | | .unwrap_or(-170_141_183_460_469_231_731_687_303_715_884_105_728);
2024-01-18 11:17:53 -06:00
| |________________________________________________________________________^ help: consider using `saturating_sub`: `1i128.saturating_sub(1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:44:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i32.checked_sub(-1).unwrap_or(i32::max_value());
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1i32.saturating_sub(-1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:45:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i32.checked_sub(-1).unwrap_or(i32::MAX);
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1i32.saturating_sub(-1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:46:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i8.checked_sub(-1).unwrap_or(127);
2024-01-18 11:17:53 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1i8.saturating_sub(-1)`
2019-09-04 02:08:48 -05:00
error: manual saturating arithmetic
2024-02-17 06:16:29 -06:00
--> tests/ui/manual_saturating_arithmetic.rs:47:13
2019-09-04 02:08:48 -05:00
|
LL | let _ = 1i128
| _____________^
LL | | .checked_sub(-1)
LL | | .unwrap_or(170_141_183_460_469_231_731_687_303_715_884_105_727);
2024-01-18 11:17:53 -06:00
| |_______________________________________________________________________^ help: consider using `saturating_sub`: `1i128.saturating_sub(-1)`
2019-09-04 02:08:48 -05:00
error: aborting due to 24 previous errors