Jason Newcomb
9500974bdb
Fix tracking of which locals would need to be captured in a closure.
...
* Captures by sub closures are now considered
* Copy types are correctly borrowed by reference when their value is used
* Fields are no longer automatically borrowed by value
* Bindings in `match` and `let` patterns are now checked to determine how a local is captured
2021-08-14 19:49:57 -04:00
Jason Newcomb
251dd30d77
Improve manual_map
...
In some cases check if a borrow made in the scrutinee expression would prevent creating the closure used by `map`
2021-08-14 19:49:54 -04:00
Jason Newcomb
4838c78ba4
Improve manual_map
and map_entry
...
Locals which can be partially moved created within the to-be-created closure shouldn't block the use of a closure
2021-08-14 19:49:45 -04:00
dswij
e9f56f949d
Add false positive test for iterator method
2021-08-13 14:56:37 +08:00
xFrednet
c02dcd5405
Update type UI tests to use private items
2021-08-12 22:18:45 +02:00
xFrednet
09b7745f34
Updated lint message for rc_mutex
2021-08-12 13:53:23 +02:00
flip1995
d02016d686
Merge remote-tracking branch 'upstream/master' into rustup
2021-08-12 10:58:44 +02:00
bors
62f4187ed0
Auto merge of #7546 - mgeier:patch-1, r=giraffate
...
similar_names: allow "iter" and "item"
changelog: [`similar_names`] no longer complains about `iter` and `item` being too similar
2021-08-12 08:16:50 +00:00
bors
e62a6cad1e
Auto merge of #7516 - lf-:unwrap-or-default, r=xFrednet
...
Add `unwrap_or_else_default` lint
---
*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: Add a new [`unwrap_or_else_default`] style lint. This will catch `unwrap_or_else(Default::default)` on Result and Option and suggest `unwrap_or_default()` instead.
2021-08-12 08:02:44 +00:00
F3real
979ce29086
Correctly report inclusive range in no_effect lint
2021-08-12 01:05:41 +02:00
Matthias Geier
f7784ef534
fix line numbers
2021-08-11 20:42:01 +02:00
Matthias Geier
ee63ebe11b
rustfmt
2021-08-11 20:35:48 +02:00
Matthias Geier
573b897441
Add test for similar names "iter" and "item"
2021-08-11 20:32:26 +02:00
bors
b1b38604f2
Auto merge of #7541 - LeSeulArtichaut:for-never-loop, r=camsteffen
...
`never_loop`: suggest using an `if let` instead of a `for` loop
changelog: suggest using an `if let` statement instead of a `for` loop that [`never_loop`]s
Fixes #7537 , r? `@camsteffen.`
2021-08-11 14:49:37 +00:00
LeSeulArtichaut
fc0af8e4d8
never_loop
: suggest using an if let
instead of a for
loop
2021-08-11 16:35:33 +02:00
Esteban Kuber
652b6a771f
update clippy
2021-08-11 14:21:33 +00:00
Jade
11ef04728c
Add unwrap_or_else_default lint
...
This will catch `unwrap_or_else(Default::default)` on Result and Option
and suggest `unwrap_or_default()` instead.
2021-08-10 14:40:26 -07:00
bors
76c4a337d1
Auto merge of #7535 - LeSeulArtichaut:7518-self-ty-arg, r=xFrednet
...
Properly handle `Self` type for `trivially_copy_pass_by_ref`
changelog: properly handle `Self` type for [`trivially_copy_pass_by_ref`].
Fixes #7518
2021-08-10 10:25:26 +00:00
bors
0084195dee
Auto merge of #7506 - HKalbasi:add-xor-swap, r=camsteffen
...
Add xor case to `manual swap` lint
Continue of #7153
closes #6598
changelog: Add "xor swap" case to [`manual_swap`]
2021-08-09 13:34:42 +00:00
hamidreza kalbasi
6d36d1a835
merge XOR_SWAP with MANUAL_SWAP
2021-08-09 02:15:10 +04:30
LeSeulArtichaut
ccb5d73dec
Properly handle Self
type for trivially_copy_pass_by_ref
2021-08-05 18:11:08 +02:00
valentine-mario
8a4ffb881d
fixed bug that had to deal with mut and non mut suggestion
2021-08-05 16:15:44 +01:00
bors
4e760b675c
Auto merge of #7522 - dswij:map-flatten-result, r=llogiq
...
Cover `Result` on `map_flatten` lint
Closes #7496
changelog: `[map_flatten]` handles `Result` type
2021-08-02 07:27:09 +00:00
bors
b6c23297bf
Auto merge of #7519 - Jarcho:rustfmt_fix, r=giraffate
...
Workaround rust-lang/rustfmt#4477 - relative paths in `path` attribute
See rust-lang/rustfmt#4477
changelog: None
2021-08-02 00:56:54 +00:00
Dharma Saputra Wijaya
69d439065e
Handle Result
on map_flatten
lint
...
Adds a check on `.map(..).flatten()` on `Result` type that follows the
behaviour on `Option` type.
2021-08-01 17:47:54 +08:00
Jason Newcomb
205aa88921
Fix while_let_on_iterator
...
When the iterator is one field within a local correctly check for usages of the field
2021-07-31 09:32:54 -04:00
Jason Newcomb
fe75faa6ee
Fix while_let_on_iterator
...
Reborrow mutable references rather then take a reference to them.
2021-07-31 00:11:46 -04:00
Jason Newcomb
fc387b877a
Workaround rust-lang/rustfmt#4477 - relative paths in path
attribute
2021-07-30 23:43:04 -04:00
bors
c9e45e47d5
Auto merge of #86754 - estebank:use-multispans-more, r=varkor
...
Use `multipart_suggestions` more
Built on top of #86532
2021-07-30 23:18:12 +00:00
Yuki Okushi
0af50b4d32
Rollup merge of #87385 - Aaron1011:final-enable-semi, r=petrochenkov
...
Make `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` warn by default
This PR makes the `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` lint warn by default.
To avoid showing a large number of un-actionable warnings to users, we only enable the lint for macros defined in the same crate. This ensures that users will be able to fix the warning by simply removing a semicolon.
In the future, I'd like to enable this lint unconditionally, and eventually make it into a hard error in a future edition. This PR is a step towards that goal.
2021-07-31 04:09:20 +09:00
Esteban Küber
9a6ae783d4
Use multispan suggestions more often
...
* Use more accurate span for `async move` suggestion
* Use more accurate span for deref suggestion
* Use `multipart_suggestion` more often
2021-07-30 09:26:31 -07:00
Aaron Hill
967a72196c
Remove unnecessary trailing semicolons from clippy tests
2021-07-29 09:52:35 -05:00
Hrishi Dharam
dbb10b87f8
add xor-swap lint
2021-07-29 15:25:08 +04:30
flip1995
2b20f49841
Merge commit '0cce3f643bfcbb92d5a1bb71858c9cbaff749d6b' into clippyup
2021-07-29 12:16:06 +02:00
flip1995
54e539121d
Rename two lints to comply with our lint naming convention
...
self_named_constructor -> self_named_constructors
append_instead_of_extend -> extend_with_drain
2021-07-29 12:10:18 +02:00
flip1995
490beda6be
Merge remote-tracking branch 'upstream/master' into rustup
2021-07-29 11:14:25 +02:00
Jacob Pratt
5331fea875
Update tests
2021-07-27 16:26:50 -04:00
bors
3214de3fe6
Auto merge of #7493 - xFrednet:7220-fix-new-without-default-impl-type, r=camsteffen
...
Prefer a code snipped over formatting the self type (`new_without_default`)
Fixes : rust-lang/rust-clippy#7220
changelog: [`new_without_default`]: The `Default` impl block type doesn't use the full type path qualification
Have a nice day to everyone reading this 🙃
2021-07-26 12:20:54 +00:00
bors
02d70f3604
Auto merge of #7477 - F3real:needless_continue, r=flip1995
...
Enhance needless continue to detect loop {continue;}
Fixes #7417
changelog: Report [`needless_continue`] in `loop { continue; }` case
2021-07-26 11:52:55 +00:00
xFrednet
89c8c3f4cd
Prefer a code snipped over formatting the self type (new_without_default
)
2021-07-26 09:35:38 +02:00
Cameron Steffen
d3492a0894
author: check block.expr: None
2021-07-25 18:10:59 -05:00
Cameron Steffen
afe5962d38
clippy::author improvements
2021-07-23 17:03:12 -05:00
chaz-kiker
1b8fc8f13d
update clippy ui test 'future_not_send.stderr' to match
...
the new diagnostic messages
2021-07-23 12:55:13 -05:00
F3real
c3452f3bd2
Lint on continue expression without semi-colon
2021-07-22 22:23:59 +02:00
F3real
9d6127cdb0
Emit needless_continue warning if loop ends on continue
2021-07-21 23:32:16 +02:00
F3real
24ec35a904
Enhance needless continue to detect loop {continue;}
2021-07-20 19:26:45 +02:00
bors
610381455c
Auto merge of #7221 - th1000s:keyword_, r=giraffate
...
similar_names: No longer suggest inserting or appending an underscore
changelog: [`similar_names`] lint no longer suggests to insert or add an underscore to "fix" too similar names
2021-07-19 14:18:59 +00:00
flip1995
884ef4c287
Merge commit '4c41a222ca5d1325fb4b6709395bd06e766cc042' into clippyup
2021-07-19 11:52:05 +02:00
bors
f467750680
Auto merge of #7470 - DevinR528:fix-ice7447, r=flip1995
...
Add check if ty has_escaping_bound_vars in zero_sized_map_values lint
Fixes : #7447
changelog: fix ICE in [`zero_sized_map_values`]
2021-07-19 09:22:34 +00:00
bors
f70a07454b
Auto merge of #7403 - Anthuang:redundant-method-names, r=Manishearth
...
New lint: [`self_named_constructor`]
Adds the `self_named_constructor` lint for detecting when an implemented method has the same name as the type it is implemented for.
changelog: [`self_named_constructor`]
closes : #7142
2021-07-19 06:49:51 +00:00