rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

Lint calling methods that are redundant to deref

Open clarfonthey opened this issue 9 years ago • 3 comments

For example, vec.as_slice().first() could be just worded as vec.first().

We'd probably want to have a whitelist for this, but in general, calling such methods is redundant.

clarfonthey avatar Sep 28 '17 22:09 clarfonthey

Probably just another branch in our method chain lint

oli-obk avatar Sep 29 '17 06:09 oli-obk

I'd call this deref_method_call_chain - a method call that is equivalent to a deref followed by another chained method call can be removed.

camsteffen avatar Nov 13 '21 23:11 camsteffen

@rustbot claim

tanndlin avatar Apr 28 '26 04:04 tanndlin