Commit Graph

26 Commits

Author SHA1 Message Date
Guillaume Gomez
74db4b7f6d Add new ui tests for map_clone lint on types implementing Copy 2024-01-11 17:44:07 +01:00
Guillaume Gomez
103e8881c6 Add tests to ensure that map_clone is not emitted if as_ref().clone() is present 2024-01-09 17:39:51 +01:00
Guillaume Gomez
8791a28c4a Also handle Result type for map_clone lint 2024-01-09 16:35:40 +01:00
Guillaume Gomez
cdd96bc662 Update ui tests for useless_asref lint extension 2024-01-09 14:14:29 +01:00
Guillaume Gomez
f66e940c88 Update ui test for map_clone lint 2024-01-07 13:24:52 +01:00
Oli Scherer
3d88fae050 Update ui test crate 2023-08-11 14:02:28 +00:00
y21
05f78e530a allow the lint in a bunch of tests 2023-06-06 22:56:57 +02:00
Oli Scherer
def1705a27 Update to a compiletest-rs version that requires //@ for commands 2023-04-20 14:44:03 +00:00
Cameron Steffen
8c0e4d5ccf Rewrite shadow lint 2021-09-30 14:07:58 -05:00
bors
c4fc076e11 Auto merge of #6269 - camsteffen:map-clone-deref, r=ebroto
Fix map_clone with deref and clone

changelog: Fix map_clone false positive with deref coercion

Fixes #6239
2020-11-11 00:48:33 +00:00
Cameron Steffen
769094410a Fix map_clone with deref and clone 2020-11-10 18:37:17 -06:00
Samuel E. Moelius III
06e81bb493 Update references 2020-11-08 18:32:12 -05:00
Aleksei Latyshev
5f57608604
do not trigger map_clone in the case of &mut 2020-11-06 14:38:46 +03:00
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