mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-21 02:23:19 +00:00
60 lines
2.6 KiB
Text
60 lines
2.6 KiB
Text
|
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());
|
||
|
| ^^^^^^^^^^^^^^^^^^ 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)]`
|
||
|
|
||
|
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());
|
||
|
| ^^^^^^^^^^^^^^^^^^ help: Replace with: `NonZeroU64::from(y)`
|
||
|
|
||
|
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());
|
||
|
| ^^^^^^^^^^^^^^^^^^ help: Replace with: `NonZeroU32::from(b)`
|
||
|
|
||
|
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());
|
||
|
| ^^^^^^^^^^^^^^^^^^ help: Replace with: `NonZeroI16::from(d)`
|
||
|
|
||
|
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());
|
||
|
| ^^^^^^^^^^^^^^^^^^ help: Replace with: `NonZeroU64::from(n)`
|
||
|
|
||
|
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());
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: Replace with: `NonZeroU64::from(max_u32)`
|
||
|
|
||
|
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());
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Replace with: `NonZeroU64::from(NonZeroU32::new(10).unwrap())`
|
||
|
|
||
|
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())
|
||
|
| ^^^^^^^^^^^^^^^^^^ help: Replace with: `NonZeroU64::from(y)`
|
||
|
|
||
|
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())
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: Replace with: `NonZeroU64::from(divisor)`
|
||
|
|
||
|
error: aborting due to 9 previous errors
|
||
|
|