Commit Graph

10058 Commits

Author SHA1 Message Date
rsulli55
56d252c53d Update clippy_lints/src/methods/mod.rs
Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-11-10 23:18:48 -07:00
Ryan Sullivant
fd303132a2 Cleaned up message and suggestion for lint_search_is_some 2020-11-10 23:18:48 -07:00
Ryan Sullivant
ee1b959054 Added period back to lint search_is_some and ran
`update-all-references.sh`
2020-11-10 23:18:47 -07:00
rsulli55
fb74b4802e Remove borrow
Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-11-10 23:18:47 -07:00
rsulli55
e9612f3eca Remove to_string on msg
Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-11-10 23:18:47 -07:00
Ryan Sullivant
55dc822062 Ran tests/ui/update-all-references.sh" and cargo dev fmt` 2020-11-10 23:18:47 -07:00
Ryan Sullivant
431fcbcc00 Moved the tests for lint search_is_some to new files
`search_is_some.rs` and `search_is_some_fixable.rs`
2020-11-10 23:18:47 -07:00
Ryan Sullivant
a1cf2d334d Added a lint as suggested in 6010 which recommends using contains()
instead of `find()` follows by `is_some()` on strings

Update clippy_lints/src/find_is_some_on_strs.rs
Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>

Update clippy_lints/src/methods/mod.rs
Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-11-10 23:18:47 -07: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
bors
d0858d0f36 Auto merge of #6303 - ThibsG:OptionOptionSerde, r=ebroto
Remove `allow` in `option_option` lint test

As it is not triggering locally anymore, I propose to remove `#[allow(clippy::option_option)]` from the test.

The goal is also to see what happens on CI.

closes: #4298

changelog: none
2020-11-10 22:39:10 +00:00
bors
467bf95ab7 Auto merge of #6319 - ebroto:rustup, r=ebroto
Rustup

changelog: none

r? `@ghost`
2020-11-10 21:36:00 +00:00
Eduardo Broto
effcb52bbf Run cargo dev fmt 2020-11-10 22:33:02 +01:00
Eduardo Broto
3ea6f77446 Merge remote-tracking branch 'upstream/master' into rustup 2020-11-10 22:32:24 +01:00
chansuke
faa3e23316 Add exteranal macros for as_conversions 2020-11-10 18:54:47 +09:00
bors
dd826b4626 Auto merge of #6305 - smoelius:master, r=flip1995
Add `let_underscore_drop`

This line generalizes `let_underscore_lock` (#5101) to warn about any initializer expression that implements `Drop`.

So, for example, the following would generate a warning:
```rust
struct Droppable;
impl Drop for Droppable {
    fn drop(&mut self) {}
}
let _ = Droppable;
```

I tried to preserve the original `let_underscore_lock` functionality in the sense that the warning generated for
```rust
let _ = mutex.lock();
```
should be unchanged.

*Please keep the line below*
changelog: Add lint [`let_underscore_drop`]
2020-11-09 19:13:26 +00:00
Dylan DPC
6294300b8e Rollup merge of #78710 - petrochenkov:macvisit, r=davidtwco
rustc_ast: Do not panic by default when visiting macro calls

Panicking by default made sense when we didn't have HIR or MIR and everything worked on AST, but now all AST visitors run early and majority of them have to deal with macro calls, often by ignoring them.

The second commit renames `visit_mac` to `visit_mac_call`, the corresponding structures were renamed earlier in https://github.com/rust-lang/rust/pull/69589.
2020-11-09 19:06:55 +01:00
Samuel E. Moelius III
4852cca61b Allow let_underscore_drop in filter_methods test 2020-11-09 07:49:14 -05:00
bors
d212c382c3 Auto merge of #6278 - ThibsG:DerefAddrOf, r=llogiq
Fix bad suggestions for `deref_addrof` and `try_err` lints

Fix bad suggestions when in macro expansion for `deref_addrof` and `try_err` lints.

Fixes: #6234
Fixes: #6242
Fixes: #6237

changelog: none

r? `@llogiq`
2020-11-09 05:25:04 +00:00
Samuel E. Moelius III
06e81bb493 Update references 2020-11-08 18:32:12 -05:00
Vadim Petrochenkov
8845f10e94 Do not collect tokens for doc comments 2020-11-09 01:47:11 +03:00
Samuel E. Moelius III
40d7af50ed Update lints 2020-11-08 17:33:54 -05:00
Samuel E. Moelius
8211b597ba
Update clippy_lints/src/let_underscore.rs
Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-11-08 17:25:50 -05:00
Samuel E. Moelius
9751cba2c6
Update clippy_lints/src/let_underscore.rs
Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-11-08 17:25:23 -05:00
Samuel E. Moelius
aa6bf1f90d
Update clippy_lints/src/let_underscore.rs
Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-11-08 17:24:55 -05:00
bors
2067a01ff1 Auto merge of #6267 - camsteffen:or-fun-idx, r=flip1995
Fix or_fun_call for index operator

changelog: Fix or_fun_call for index operator

Fixes #6266
2020-11-08 22:03:27 +00:00
Cameron Steffen
9cab08465b Fix or_fun_call for index operator 2020-11-08 14:49:42 -06:00
Cameron Steffen
b0994064b0 Make KNOW_TYPES static 2020-11-08 14:34:06 -06:00
bors
040d0ca4da Auto merge of #6288 - flip1995:changelog_internal, r=matthiaskrgr
Require the `changelog:` entry in the PR body to be modified

r? `@matthiaskrgr`

changelog: none
2020-11-08 19:37:25 +00:00
flip1995
7c612c1c50
Force contributors/reviewers to set _some_ changelog entry 2020-11-08 16:18:25 +01:00
bors
7079de9b35 Auto merge of #6293 - Urcra:lint-example-fix, r=flip1995
Fix example used in cargo_common_metadata

The previous example used in `cargo_common_metadata`  included an authors field, even though the comment says it doesn't. And thus doesn't actually demonstrate an example of how the lint fails.

This removes that authors field from the _bad_ example and suggest to fix the _bad_ example by adding the authors field

changelog: Fix example used in `cargo_common_metadata`
2020-11-08 14:24:58 +00:00
Samuel E. Moelius III
9c6a0b9c34 Update references 2020-11-08 07:07:49 -05:00
bors
b1faa7f002 Auto merge of #6271 - camsteffen:vec-box-import, r=flip1995
Fix vec_box scope error

changelog: Fix vec_box suggestion with wrong type scope

Fixes #6236
2020-11-08 12:02:30 +00:00
Samuel E. Moelius III
f1f780c942 Add let_underscore_drop 2020-11-08 07:00:35 -05:00
bors
abfa331f26 Auto merge of #6205 - josephlr:empty-loop2, r=flip1995
Enable empty_loop lint for no_std crates

Depends on #6162. Fixes #6161

We skip the lint if the `loop {}` is in the `#[panic_handler]` as the
main recommendation we give is to panic, which obviously isn't
possible in a panic handler.

changelog: Enable empty_loop lint for no_std crates
2020-11-08 11:41:22 +00:00
flip1995
00dee9d916
Update reference files 2020-11-08 12:40:41 +01:00
Joseph Richey
3579b7de24
Update clippy_lints/src/loops.rs
Fix NITs

Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-11-08 12:38:10 +01:00
Joe Richey
c6a91df838
Enable empty_loop lint for no_std crates
We skip the lint if the `loop {}` is in the `#[panic_handler]` as the
main recommendation we give is to panic, which obviously isn't
possible in a panic handler.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-11-08 12:38:10 +01:00
bors
96d5f45ade Auto merge of #6301 - alex-700:fix-map-clone, r=matthiaskrgr
do not trigger map_clone in the case of &mut

fixes #6299
changelog: do not trigger map_clone in the case of &mut
2020-11-08 01:28:27 +00:00
bors
c015622568 Auto merge of #6304 - matthiaskrgr:crash_6302, r=llogiq
FROM_ITER_INSTEAD_OF_COLLECT: avoid unwrapping unconditionally

Fixes #6302

changelog: fix unwrap of None when checking libcore with clippy
2020-11-07 18:10:35 +00:00
bors
5effc99812 Auto merge of #6298 - JohnTitor:fix-example, r=llogiq
Fix `await_holding_refcell_ref` examples for clarify

- Remove redundant `()`
- Fix variable name

changelog: none
2020-11-07 17:48:46 +00:00
bors
4aca13f56b Auto merge of #6287 - camsteffen:readme, r=llogiq
Readme improvements

~Moved the table of contents up, added an Overview heading.~

~Made the "All the Clippy Lints" link clearer.~

Formatted the lint categories as a table with the default lint level (instead of saying on/off by default). Tweaked the descriptions.

changelog: Improve Readme
2020-11-07 17:26:58 +00:00
bors
92ba07582e Auto merge of #6134 - patrickelectric:as_utf8, r=llogiq
Check when `from_utf8` is called from sliced byte array from string

---

*Please keep the line below*
changelog: Fix #5487: Add linter to check when `from_utf8` is called from sliced byte array from string.
2020-11-07 17:06:27 +00:00
bors
694cec12be Auto merge of #6110 - rail-rain:care_enums_non_copy_const, r=llogiq
"Respect" enums in `interior_mutable_const`

fixes #3962
fixes #3825

Hello,

It might not be a good idea to submit another relatively large PR while I have an opened PR; but, I've finished this anyway. This may be able to wait for months.

Note: the code uses the MIR interpreter, which the author of #3962 thought unlikely to be a solution. This might be over-engineering; but, I think it's important to be able to work with the 'http' crate (#3825). (And, I don't want to write a MIR visitor)

---

changelog: fix a false positive in two `interior_mutable_const` lints where a constant with enums gets linted
even if it uses a clearly unfrozen variant
2020-11-07 15:51:13 +00:00
bors
4bbef42c48 Auto merge of #6272 - camsteffen:unnecesary-lazy-eval-type, r=llogiq
Fix unnecessary_lazy_eval suggestion applicability

changelog: Fix unnecessary_lazy_eval suggestion applicability when breaking type inference

Fixes #6240
2020-11-07 10:01:46 +00:00
Matthias Krüger
5253595b3b FROM_ITER_INSTEAD_OF_COLLECT: avoid unwrapping unconditionally
Fixes #6302
2020-11-06 19:34:34 +01:00
bors
2ea08e1c53 Auto merge of #6294 - giraffate:fix_suggestion_to_add_space_in_manual_async, r=Manishearth
Fix suggestion to add unneeded space in `manual_async`

Fix a same case as https://github.com/rust-lang/rust-clippy/pull/6247

changelog: Fix suggestion to add unneeded space in `manual_async`
2020-11-06 18:10:43 +00:00
ThibsG
8242b2f0a4 Remove needless allow 2020-11-06 18:11:58 +01:00
Takayuki Nakata
b7892c6a26 Refactor to make getting position just before RArrow a common function 2020-11-06 22:54:38 +09:00
Aleksei Latyshev
5f57608604
do not trigger map_clone in the case of &mut 2020-11-06 14:38:46 +03:00