-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-lintArea: New lintsArea: New lintsL-restrictionLint: Belongs in the restriction lint groupLint: Belongs in the restriction lint groupgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
I think Clippy should start suggesting the usage of NonZeroU#::from
from smaller NonZeroU#
, as in code like:
#![allow(unused_variables)]
use std::num::{NonZeroU32, NonZeroU64};
fn main() {
let x: u64 = 100;
let y = NonZeroU32::new(10).unwrap();
// Given code:
let r1 = x / u64::from(y.get());
let r2 = x % u64::from(y.get());
// Clippy should suggest:
let r1 = x / NonZeroU64::from(y);
let r2 = x % NonZeroU64::from(y);
}
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsL-restrictionLint: Belongs in the restriction lint groupLint: Belongs in the restriction lint groupgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy