rust-num / num-bigint

Big integer types for Rust
Apache License 2.0
540 stars 188 forks source link

style: use strip_prefix instead of manual starts_with/slice #309

Closed yhx-12243 closed 5 months ago

yhx-12243 commented 5 months ago

strip_prefix is stable since 1.45.0, which is less than the MSRV (1.60) of this crate, and it generally generates better code.

cuviper commented 5 months ago

I'm surprised clippy didn't see this, but maybe it only lints if there's a manual len() too. https://rust-lang.github.io/rust-clippy/master/#/manual_strip

Thanks!

yhx-12243 commented 5 months ago

I'm surprised clippy didn't see this, but maybe it only lints if there's a manual len() too. https://rust-lang.github.io/rust-clippy/master/#/manual_strip

Thanks!

Yes I've already proposed at rust-lang/rust-clippy#12863. 👀