Commit graph

13 commits

Author SHA1 Message Date
Eduardo Broto
806d973adc map_clone: avoid suggesting copied() for &mut 2020-04-25 22:52:19 +02:00
Michael Wright
b15b977d76 Fix map_clone false positive
Don't lint when the item type is not a reference. `copied` only applies
to references.
2019-12-22 11:26:51 +02:00
Shotaro Yamada
555f5a49a2 Test fixes 2019-10-03 08:10:29 +09:00
flip1995
08d2a0d6b2
Also rename the lint in test files 2019-05-16 20:18:07 +02:00
Michael Wright
4fcaab3d62 Split redundant_closure lint
Move the method checking into a new lint called
`redundant_closures_for_method_calls` and put it in the pedantic group.

This aspect of the lint seems more controversial than the rest.

cc #3942
2019-05-16 08:25:39 +02:00
Manish Goregaokar
770de14505 Suggest .copied() for map_clone on iterators too 2019-04-28 11:14:39 -07:00
Manish Goregaokar
e9cde416ba Only suggest .copied() for Option right now 2019-04-15 15:44:09 -07:00
Manish Goregaokar
ad2c65bd1b Also suggest .copied() when .clone() is called on a Copy type 2019-04-15 14:39:41 -07:00
Manish Goregaokar
d2f7ae70ae Suggest .copied() instead of .cloned() in map_clone when dealing with references 2019-04-15 14:32:39 -07:00
Grzegorz
16881390e1 removing redundant closures in the whole project 2019-02-10 13:35:44 +01:00
Michael Wright
f53f12b0c3 Fix issue number in map_clone test 2019-01-15 08:17:55 +02:00
Michael Wright
67a9f20c91 Fix map_clone bad suggestion
`cloned` requires that the elements of the iterator must be references. This
change determines if that is the case by examining the type of the closure
argument and suggesting `.cloned` only if it is a reference. When the closure
argument is not a reference, it suggests removing the `map` call instead.

A minor problem with this change is that the new check sometimes overlaps
with the `clone_on_copy` lint.

Fixes #498
2019-01-15 08:09:47 +02:00
Wilco Kusee
9ff821a7e8 Add run-rustfix to map_clone test 2019-01-13 13:10:25 +01:00