Commit graph

9801 commits

Author SHA1 Message Date
bors
e1a2845558 Auto merge of #6226 - Urcra:master, r=flip1995
Add lint for comparing to empty slices instead of using .is_empty()

Hey first time making a clippy lint

I added the implementation of the lint the `len_zero` since it shared a lot of the code, I would otherwise have to rewrite. Just tell me if the lint should use it's own file instead

changelog: Add lint for comparing to empty slices

Fixes #6217
2020-10-29 15:12:24 +00:00
bors
ee9da9a194 Auto merge of #6176 - achris:issues/578, r=phansch
Lint items after statements in local macro expansions

The items_after_statements lint was skipping all expansions.  Instead
we should still lint local macros.

Fixes #578

---

*Please keep the line below*
changelog: The items_after_statements now applies to local macro expansions
2020-10-29 14:51:41 +00:00
Christian Nielsen
e3de544c22
Remove empty lines in doc comment
Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-10-29 15:49:42 +01:00
bors
e8de57c20d Auto merge of #6212 - ThibsG:MacroTopLevelRefArg, r=flip1995
No lint in macro for `toplevel_ref_arg`

Do not lint when the span is from a macro.

Question: shouldn't we extend this for external macros also ?

Fixes: #5849

changelog: none
2020-10-29 14:29:30 +00:00
bors
6d5cd6eb8d Auto merge of #6264 - matthiaskrgr:ra_setup_no_twice, r=llogiq
cargo dev ra-setup: don't inject deps multiple times if we have already done so

Fixes #6220

changelog: none
2020-10-29 07:49:27 +00:00
Matthias Krüger
7f3462aa89 cargo dev ra-setup: don't inject deps multiple times if we have already done so
Fixes #6220
2020-10-29 03:22:02 +01:00
bors
4f1240fd94 Auto merge of #6263 - matthiaskrgr:diff_u, r=ebroto
use diff -u in driver.sh test

this changs the add/delete indication from
>
>
<
to
+
+
-
(same as git diff)

changelog: none
2020-10-28 22:33:01 +00:00
Matthias Krüger
0d6eed1b1f use diff -u in driver.sh test
this changs the add/delete indication from
>
>
<
to
+
+
-
(same as git diff)
2020-10-28 23:19:04 +01:00
bors
645ef505da Auto merge of #6257 - giraffate:sync-from-rust, r=ebroto
Rustup

changelog: none
2020-10-28 21:53:23 +00:00
Eduardo Broto
e83e79f1c2 Reinstate link to temporary_cstr_as_ptr 2020-10-28 22:36:22 +01:00
Eduardo Broto
a50d9e7af6 Deprecate temporary_cstr_as_ptr 2020-10-28 22:34:45 +01:00
Takayuki Nakata
c42a22d2dc Use double_neg.stderr 2020-10-29 01:02:09 +09:00
Takayuki Nakata
ffc2e66671 Fix reference 2020-10-28 14:36:29 +09:00
Takayuki Nakata
dace756c6f cargo dev update_lints 2020-10-28 14:25:41 +09:00
Takayuki Nakata
8e988e1c66 Merge remote-tracking branch 'upstream/master' into sync-from-rust 2020-10-28 14:14:09 +09:00
bors
de83f09be8 Auto merge of #6216 - alex-700:improve-match-like-matches-lint, r=ebroto
Improve match like matches lint

fixes #6186

changelog: improve MATCH_LIKE_MATCHES_MACRO lint
2020-10-27 23:01:35 +00:00
Aleksei Latyshev
2b7dd31368
improve MATCH_LIKE_MATCHES_MACRO lint
- add tests
- refactor match_same_arms lint
- prioritize match_expr_like_matches_macro over match_same_arms
2020-10-27 23:45:58 +03:00
Aleksei Latyshev
09e7053607
simplify SpanlessEq::eq_path_segment 2020-10-27 20:44:41 +03:00
bors
8823684197 Auto merge of #6244 - mikerite:invalid_paths_20201027, r=flip1995
New internal lint: Invalid paths

Add a new internal lint that detects invalid paths in the `util::paths` and fix some invalid paths found.

This commit partially addresses #6047 but the lint would have to be run before running tests to close that issue.

changelog: none
2020-10-27 11:16:21 +00:00
Michael Wright
f79c4afd3a Fix invalid paths 2020-10-27 07:43:38 +02:00
Michael Wright
66d56fefc5 Add invalid_paths internal lint 2020-10-27 07:42:13 +02:00
Nathan Whitaker
a1bb10e9b8 Remove lint from clippy 2020-10-26 18:19:48 -04:00
ThibsG
bab338685f No lint in external macro for toplevel_ref_arg 2020-10-26 10:14:03 +01:00
Urcra
45aa3ef8dd Remove unnecesary format 2020-10-26 01:55:44 +01:00
Urcra
4532dd9e43 run cargo fmt 2020-10-26 01:31:13 +01:00
Urcra
4cf5b5ff70 Run update lints 2020-10-26 01:21:34 +01:00
Urcra
deecfb5d13 Add description to lint 2020-10-26 01:02:10 +01:00
Urcra
4417af801d Revert changes to Cargo.toml file 2020-10-26 00:53:51 +01:00
Urcra
7f7faa1ccf Move implementation into len_zero.rs 2020-10-26 00:51:18 +01:00
Urcra
de5a6d3420 Initial implementation of comparison_to_empty 2020-10-26 00:31:25 +01:00
bors
afbac8906e Auto merge of #6225 - rust-lang:flip1995-patch-1, r=flip1995
Update triagebot.toml

r? `@ghost`
changelog: none
2020-10-25 20:35:17 +00:00
Philipp Krones
80b21682bf
Update triagebot.toml 2020-10-25 21:34:46 +01:00
bors
83bb5ecec8 Auto merge of #6202 - giraffate:fix_invalid_suggestion_in_needless_collect_test, r=flip1995
Fix an invalid suggestion in `needless_collect` test

A test, https://github.com/rust-lang/rust-clippy/blob/master/tests/ui/needless_collect_indirect.rs#L11-L12, suggests following codes, but the suggested codes don't work. An example is here: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6947d9f2806a83f41cc5eb8e39b09d0b.
```
error: avoid using `collect()` when not needed
  --> $DIR/needless_collect_indirect.rs:11:5
   |
LL | /     let indirect_contains = sample.iter().collect::<VecDeque<_>>();
LL | |     indirect_contains.contains(&&5);
   | |____^
   |
help: Check if the original Iterator contains an element instead of collecting then checking
   |
LL |
LL |     sample.iter().any(|x| x == &&5);
```

changelog: none
2020-10-25 17:35:33 +00:00
bors
15f6fb99e4 Auto merge of #6194 - giraffate:remove_an_extra_blank_line, r=flip1995
Remove an extra blank line in doc examples

It seems to be an extra blank line in doc example.

changelog: none

<img width="1141" alt="スクリーンショット 2020-10-19 10 32 21" src="https://user-images.githubusercontent.com/17407489/96392372-d0583200-11f6-11eb-9aab-f7e8f87eb04e.png">
2020-10-25 17:15:42 +00:00
bors
eceebc3448 Auto merge of #6183 - cgm616:hex_bin_digit_grouping, r=flip1995
Hex bin digit grouping

This revives and updates an old pr (#3391) for the current API.

Closes #2538.

---

*Please keep the line below*
changelog: Add [`unusual_byte_groupings`] lint.
2020-10-25 16:40:14 +00:00
bors
4242ef8ecd Auto merge of #6224 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2020-10-25 15:45:12 +00:00
flip1995
77746b9060
Merge remote-tracking branch 'upstream/master' into rustup 2020-10-25 16:43:53 +01:00
cgm616
312bbff696
Integrate suggestions from code review 2020-10-25 11:31:24 -04:00
Takayuki Nakata
2f5d418011 Add test case 2020-10-26 00:01:20 +09:00
Takayuki Nakata
3ce820bf83 Fix an invalid suggestion in needless_collect test 2020-10-25 23:58:14 +09:00
cgm616
e7e4b35bdf Fix logic mistake 2020-10-25 09:34:46 -04:00
cgm616
0c0f8db347 Remove accidental test inclusion 2020-10-25 09:19:58 -04:00
cgm616
f5a88b6de5 Allow hex literals to pass w/ groups of 2 2020-10-25 09:18:38 -04:00
Florian Hartwig
db8380c4a0 Add lint for unusually-grouped hex/binary literals 2020-10-25 09:18:38 -04:00
bors
9c9aa2db52 Auto merge of #6222 - JohnTitor:redundant-local-def-id, r=flip1995
Remove redundant `expect_local()` call

The field `owner` of `HirId` is `LocalDefId` and `hir_id.owner.to_def_id().expect_local()` is redundant. I wonder they were introduced in some rustups.

changelog: none
2020-10-25 11:58:51 +00:00
bors
718bb28f68 Auto merge of #6211 - ThibsG:NeedlessBoolCfg, r=flip1995
No lint with `cfg!` and fix sugg for macro in `needless_bool` lint

Don't lint if `cfg!` macro is one of the operand.
Fix suggestion when the span originated from a macro, using `hir_with_macro_callsite`.

Fixes: #3973

changelog: none
2020-10-25 11:37:18 +00:00
bors
38be214724 Auto merge of #6198 - montrivo:needless-lifetime, r=flip1995
needless-lifetime / multiple where clause predicates regression

Closes #6159.

changelog: fix regression in needless-lifetimes
2020-10-25 11:15:01 +00:00
bors
90cb25d3f6 Auto merge of #6177 - rust-lang:manual-range-contains, r=flip1995
New lint: manual-range-contains

This fixes #1110, at least for the contains-suggesting part.

- \[x] Followed [lint naming conventions][lint_naming]
- \[x] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[x] Executed `cargo dev update_lints`
- \[x] Added lint documentation
- \[x] Run `cargo dev fmt`
---

changelog: new lint: manual-range-contains
2020-10-25 10:35:46 +00:00
Yuki Okushi
d5713898ac Remove redundant expect_local() call 2020-10-25 19:30:00 +09:00
bors
399732bf79 Auto merge of #6103 - FrancisMurillo:mut_mutex_lock, r=flip1995
Add lint for `&mut Mutex::lock`

Fixes #1765

changelog: Add lint [`mut_mutex_lock`] for `&mut Mutex::lock` and suggests using `&mut Mutex::get_mut` instead.
2020-10-25 10:16:23 +00:00