mirror of
https://github.com/astral-sh/ruff
synced 2026-01-07 14:44:17 -05:00
[ruff] Unnecessary cast to int (RUF046) (#14697)
## Summary Resolves #11412. ## Test Plan `cargo nextest run` and `cargo insta test`. --------- Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
@@ -96,7 +96,7 @@ impl Int {
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the [`Int`] as an u64, if it can be represented as that data type.
|
||||
/// Return the [`Int`] as an usize, if it can be represented as that data type.
|
||||
pub fn as_usize(&self) -> Option<usize> {
|
||||
match &self.0 {
|
||||
Number::Small(small) => usize::try_from(*small).ok(),
|
||||
|
||||
Reference in New Issue
Block a user