Commit Graph

26 Commits

Author SHA1 Message Date
Matthew Ingwersen
329dc4715b Fix redundant_closure_for_method_calls suggestion
Certain types must be enclosed in angle brackets and must have generic
arguments substituted to create a working suggestion. For example, if
`s` has type `&[u8]`, then `|s| s.len()` may be replaced with
`<[u8]>::len`. Previously, Clippy erroneously suggested `[T]::len`.
2022-10-28 16:25:51 -04:00
Yuri Astrakhan
eb3970285b fallout: fix tests to allow uninlined_format_args
In order to switch `clippy::uninlined_format_args` from pedantic to
style, all existing tests must not raise a warning. I did not want to
change the actual tests, so this is a relatively minor change that:

* add `#![allow(clippy::uninlined_format_args)]` where needed
* normalizes all allow/deny/warn attributes
   * all allow attributes are grouped together
   * sorted alphabetically
   * the `clippy::*` attributes are listed separate from the other ones.
   * deny and warn attributes are listed before the allowed ones

changelog: none
2022-10-02 15:13:22 -04:00
Evan Typanski
dbadf37336 Add test case where FnMut used once needs &mut 2022-09-30 11:38:12 -04:00
Evan Typanski
416da1264c [redundant_closure] Add &mut to more cases 2022-09-29 19:35:04 -04:00
Alex Macleod
eae9c56aab Add tests for some fixed redundant_closure issues 2022-06-10 13:25:22 +00:00
dswij
33bf9e9a54 redundant_closure ignore coerced closure 2022-04-27 13:05:01 +08:00
Alex Macleod
5e335a52bc Check for loops/closures in local_used_after_expr 2022-04-10 14:26:44 +01:00
tamaron
db62821c03 fix 2022-02-24 00:16:24 +09:00
Jason Newcomb
9e9110e4f3 Remove final reference on fields and method calls in needless_borrow 2022-01-22 20:35:32 -05:00
Elliot Bobrow
828ddbe414 fix [redundant_closure] fp with Arc 2021-12-29 09:05:04 -08:00
David Tolnay
c2783c1dcb
Downgrade many_single_char_names to pedantic 2021-09-14 09:59:06 -07:00
Cameron Steffen
5782dc0eb9 Fix redundant closure bugs 2021-09-09 17:10:59 -05:00
Elliot Bobrow
4c398e07e0 suggest &mut for redundant FnMut closures 2021-07-14 07:56:27 -07:00
Jason Newcomb
60dd2b65dc
Fix redundant_closure for vec![] macro in a closure with arguments 2021-05-21 15:48:29 -04:00
Cameron Steffen
bf98aa6fb8 Fix redundant closure with macros 2021-03-08 13:15:13 -06:00
David Tolnay
94154cad20
Downgrade trivially_copy_pass_by_ref to pedantic 2020-04-02 18:56:10 -07:00
Grzegorz
d4ad23bb3f redundant_closure_for_method_calls fixes:
lint does not trigger when there is a difference in mutability
lint does not trigger when the method belongs to a trait which is not implemebted directly (Deref)
2019-06-12 13:43:36 +02:00
Alexander Shabalin
41a4ce52dd Workaround for rust-lang/rustfmt#3615 2019-06-10 20:19:29 +03:00
Alexander Shabalin
86bab94631 Fixing eta with respect to lazy evaluation. 2019-06-10 13:58:40 +03:00
Philipp Hansch
2c72026fcb
Rustup to https://github.com/rust-lang/rust/pull/61203
Migrates all trait objects to use `dyn`
2019-05-30 08:31:09 +02: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
Philipp Hansch
3f637cb369
Add two more tests for redundant_closure
These two cases were fixed by #4008.

Closes #1439

changelog: none
2019-04-26 06:48:27 +02:00
Grzegorz
4f801a278d redundant closure triggers for fnptrs and closures 2019-04-20 22:20:14 +02:00
Grzegorz
aa9cf07d56 redundant closure for functions restricted to FnDefs 2019-04-19 15:14:49 +02:00
Philipp Hansch
9e4e1302a6
Add // run-rustfix for eta.rs test
cc #3071, #3630
2019-04-10 08:16:07 +02:00