5 ms·
I’m pretty sure clippy “encourages” you to use .get() for Vectors returning an Option<> for you to deal with so accessing a bad index is avoidable in idiomatic
by jayflux 7y ago
I’m pretty sure clippy “encourages” you to use .get() for Vectors returning an Option<> for you to deal with so accessing a bad index is avoidable in idiomatic rust.
I’m not sure that was the best example but I agree with your overall point.
- GrayShade 7y agoIt doesn't: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=850feb616235ea3cfc2f841629937eee https://play.rust-lang.org/?version=stable&mode=debug&editio... (click Tools / Clippy).
- burntsushi 7y agoIt does not. I know because I advocated against it. :-) https://github.com/rust-lang/rust-clippy/issues/1300 https://github.com/rust-lang/rust-clippy/issues/1300 Also, Clippy's defaults are developed to be quite opinionated. It makes many suggestions that I (and many others) disagree with. So Clippy's defaults should not be used as a bludgeon for what's idiomatic and correct.
- steveklabnik 7y ago(I also do not use clippy very aggressively due to disagreeing with a lot of lints)