rust-clippy/tests/ui/non_zero_suggestions.stderr

60 lines
2.6 KiB
Text
Raw Normal View History

2024-07-26 12:46:08 +00:00
error: consider using `NonZeroU64::from()` for more efficient and type-safe conversion
--> tests/ui/non_zero_suggestions.rs:11:18
|
LL | let r1 = x / u64::from(y.get());
2024-07-26 12:46:08 +00:00
| ^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroU64::from(y)`
|
= note: `-D clippy::non-zero-suggestions` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::non_zero_suggestions)]`
2024-07-26 12:46:08 +00:00
error: consider using `NonZeroU64::from()` for more efficient and type-safe conversion
--> tests/ui/non_zero_suggestions.rs:12:18
|
LL | let r2 = x % u64::from(y.get());
2024-07-26 12:46:08 +00:00
| ^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroU64::from(y)`
2024-07-26 12:46:08 +00:00
error: consider using `NonZeroU32::from()` for more efficient and type-safe conversion
--> tests/ui/non_zero_suggestions.rs:17:18
|
LL | let r3 = a / u32::from(b.get());
2024-07-26 12:46:08 +00:00
| ^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroU32::from(b)`
2024-07-26 12:46:08 +00:00
error: consider using `NonZeroI16::from()` for more efficient and type-safe conversion
--> tests/ui/non_zero_suggestions.rs:22:14
|
LL | let r4 = i16::from(d.get());
2024-07-26 12:46:08 +00:00
| ^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroI16::from(d)`
2024-07-26 12:46:08 +00:00
error: consider using `NonZeroU64::from()` for more efficient and type-safe conversion
--> tests/ui/non_zero_suggestions.rs:27:18
|
LL | let r5 = m / u64::from(n.get());
2024-07-26 12:46:08 +00:00
| ^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroU64::from(n)`
2024-07-26 12:46:08 +00:00
error: consider using `NonZeroU64::from()` for more efficient and type-safe conversion
--> tests/ui/non_zero_suggestions.rs:33:14
|
LL | let r6 = u64::from(max_u32.get());
2024-07-26 12:46:08 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroU64::from(max_u32)`
2024-07-26 12:46:08 +00:00
error: consider using `NonZeroU64::from()` for more efficient and type-safe conversion
--> tests/ui/non_zero_suggestions.rs:36:13
|
LL | let _ = u64::from(NonZeroU32::new(10).unwrap().get());
2024-07-26 12:46:08 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroU64::from(NonZeroU32::new(10).unwrap())`
2024-07-26 12:46:08 +00:00
error: consider using `NonZeroU64::from()` for more efficient and type-safe conversion
--> tests/ui/non_zero_suggestions.rs:58:9
|
LL | x / u64::from(y.get())
2024-07-26 12:46:08 +00:00
| ^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroU64::from(y)`
2024-07-26 12:46:08 +00:00
error: consider using `NonZeroU64::from()` for more efficient and type-safe conversion
--> tests/ui/non_zero_suggestions.rs:67:22
|
LL | self.value / u64::from(divisor.get())
2024-07-26 12:46:08 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroU64::from(divisor)`
error: aborting due to 9 previous errors