Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need numeric trait for converting to Option<uint> #8605

Closed
lilyball opened this issue Aug 19, 2013 · 1 comment
Closed

Need numeric trait for converting to Option<uint> #8605

lilyball opened this issue Aug 19, 2013 · 1 comment

Comments

@lilyball
Copy link
Contributor

In order to implement size_hint() on Range, we need some numeric trait that covers the ability to convert a given type to uint (or more generally, Option<uint>, to cover out of bounds conversions).

More specifically, we need to convert the result of a - b where a and b are values of the numeric type. The definition for this conversion to uint would be the number of times that you'd have to add One::one() to the result to get a back (which is the obvious definition, really).

This is needed because range() doesn't restrict its inputs to primitive numeric types.

@emberian
Copy link
Member

emberian commented Nov 4, 2013

Closing, ToPrimitive fills this gap.

@emberian emberian closed this as completed Nov 4, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Apr 7, 2022
Remove deps

This remove both `regex` and `cargo_metadata` as dependencies making `clippy_dev` compile ~3x faster (~46s -> ~16s locally). `cargo_metadata` was used to extract the `version` field from `Cargo.toml`, which is done trivially without that. `regex` was used to parse `define_clippy_lint` in `update_lints` which is now done using `rustc_lexer`. This isn't any simpler, but it compiles ~15s faster and runs ~3x faster (~2.1s -> ~0.7s locally).

The next biggest offenders to compile times are `clap` and `winapi` on windows. `clap` could be removed, but re-implementing enough is probably more work than it's worth. `winapi` is used by `opener` and `walkdir` so it's stuck there.

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants