mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:10 +00: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:
parent
2d3f557875
commit
fda8b1f884
9 changed files with 672 additions and 1 deletions
|
@ -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(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue