all tests passed

This commit is contained in:
Samarth1696 2024-07-26 18:16:08 +05:30
parent 6f01273d5d
commit 0f99aa992e
2 changed files with 20 additions and 20 deletions

View file

@ -92,8 +92,8 @@ fn suggest_non_zero_conversion(
cx,
NON_ZERO_SUGGESTIONS,
expr.span,
format!("Consider using `{target_non_zero_type}::{fn_name}()` for more efficient and type-safe conversion"),
"Replace with",
format!("consider using `{target_non_zero_type}::{fn_name}()` for more efficient and type-safe conversion"),
"replace with",
suggestion,
Applicability::MachineApplicable,
);

View file

@ -1,59 +1,59 @@
error: Consider using `NonZeroU64::from()` for more efficient and type-safe conversion
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)`
| ^^^^^^^^^^^^^^^^^^ 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
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)`
| ^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroU64::from(y)`
error: Consider using `NonZeroU32::from()` for more efficient and type-safe conversion
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)`
| ^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroU32::from(b)`
error: Consider using `NonZeroI16::from()` for more efficient and type-safe conversion
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)`
| ^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroI16::from(d)`
error: Consider using `NonZeroU64::from()` for more efficient and type-safe conversion
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)`
| ^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroU64::from(n)`
error: Consider using `NonZeroU64::from()` for more efficient and type-safe conversion
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)`
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroU64::from(max_u32)`
error: Consider using `NonZeroU64::from()` for more efficient and type-safe conversion
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())`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroU64::from(NonZeroU32::new(10).unwrap())`
error: Consider using `NonZeroU64::from()` for more efficient and type-safe conversion
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)`
| ^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroU64::from(y)`
error: Consider using `NonZeroU64::from()` for more efficient and type-safe conversion
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)`
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `NonZeroU64::from(divisor)`
error: aborting due to 9 previous errors