Commit Graph

14331 Commits

Author SHA1 Message Date
kyoto7250
3a9c0ef8a1 fix for git rebase 2022-06-27 08:11:58 +09:00
kyoto7250
dd3d0fdad3 rename use_retain => manual_retain 2022-06-27 08:11:58 +09:00
kyoto7250
4decfdec76 check msrv 2022-06-27 08:11:58 +09:00
kyoto7250
14212115c4 rewrite without if_chain macro 2022-06-27 08:11:58 +09:00
kyoto7250
fd629c0cde check method 2022-06-27 08:11:58 +09:00
kyoto7250
3953c530f4 change lint type from style to perf 2022-06-27 08:11:58 +09:00
kyoto7250
e3afc72caa remove needless return 2022-06-27 08:11:58 +09:00
kyoto7250
b20b8f10dd Update clippy_lints/src/use_retain.rs
Co-authored-by: llogiq <bogusandre@gmail.com>
2022-06-27 08:11:58 +09:00
kyoto7250
5f2b8e67b3 feat(new lint): new lint use_retain 2022-06-27 08:11:58 +09:00
bors
9b150625a9 Auto merge of #9032 - kyoto7250:issue_9018, r=llogiq
enum_variant_names should ignore when all prefixes are _

close #9018

When Enum prefix is only an underscore, we should not issue warnings.

changelog: fix false positive in enum_variant_names
2022-06-26 16:11:06 +00:00
bors
ab58276146 Auto merge of #9055 - kyoto7250:update_nodejs_in_github_action, r=Manishearth
update node.js version in `remark.yml`

Optional chain (`?.`) is available in `node v14`, but node version in CI is `node v12`, so CI is failed now.

ref:
https://github.com/rust-lang/rust-clippy/runs/7059529735?check_suite_focus=true

optional chain:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining#browser_compatibility

Corresponding PR (maybe)
https://github.com/remarkjs/remark/pull/1007

changelog: None
2022-06-26 15:07:22 +00:00
kyoto7250
11bf291189 update node.js version 2022-06-26 20:19:32 +09:00
kyoto7250
d827b834d9 use all instead of join 2022-06-26 16:11:04 +09:00
kyoto7250
bf317a83cf
treat argument as a slice.
Co-authored-by: llogiq <bogusandre@gmail.com>
2022-06-26 15:55:44 +09:00
bors
8789f4e88a Auto merge of #8985 - botahamec:single-match-option, r=llogiq
Lint `[single_match]` on `Option` matches

fixes #8928

changelog: did some cleanup of the logic for ``[`single_match`]`` and ``[`single_match_else`]`` which fixes the bug where `Option` matches were not linted unless a wildcard was used for one of the arms.
2022-06-25 16:48:34 +00:00
bors
93ebd0e2db Auto merge of #9015 - kyoto7250:issue_8493, r=Jarcho
ignore item in `thread_local!` macro

close #8493

This PR ignores `thread_local` macro in `declare_interior_mutable_const`.

changelog: ignore `thread_local!` macro in `declare_interior_mutable_const`
2022-06-25 02:40:30 +00:00
bors
e17864e2ff Auto merge of #9031 - evantypanski:manual_rem_euclid, r=Jarcho
Add [`manual_rem_euclid`] lint

Closes #8883

Adds a lint for checking manual use of `rem_euclid(n)`

changelog: Add [`manual_rem_euclid`] lint
2022-06-24 17:49:53 +00:00
bors
1d1ae10876 Auto merge of #9037 - smoelius:fix-extra-unused-lifetimes-fp, r=dswij
Fix `extra_unused_lifetimes` false positive

This PR fixes #9014.

I confirmed the FP on the `crates.io` source as `@JohnTitor` mentioned, and confirmed that the FP is no longer present following this change.

I did not include a test in this PR because I think constructing one would be complicated, and the fix is pretty simple. But please let me know if this is unacceptable.

changelog: fix `extra_unused_lifetimes` FP
2022-06-24 08:39:45 +00:00
bors
3f47cd1752 Auto merge of #9036 - xFrednet:0000-force-warn-in-driver, r=dswij
Check for `--force-warn` in Clippy's driver run condition

Just a thing I've noticed while tinkering on the driver. Currently, the driver only checks for `--cap-lints=allow` to determine if Clippy should run on the code, but ignores possible `--force-warn` arguments

---

changelog: Others: Allowing all lints and only `--force-warn`ing some will now work with Clippy's driver
2022-06-24 02:26:35 +00:00
bors
f7189846be Auto merge of #8953 - DevAccentor:slow_vector_initialization, r=Manishearth
add vec.capacity() to [`slow_vec_initialization`] detection

fix #8800

for example
```rust
let mut vec1 = Vec::with_capacity(len);
vec1.resize(vec1.capacity(), 0);

let mut vec2 = Vec::with_capacity(len);
vec2.extend(repeat(0).take(vec2.capacity()));
```
will trigger the lint

---

changelog: add `vec.capacity()` to [`slow_vec_initialization`] detection
2022-06-23 22:29:52 +00:00
Evan Typanski
df26c3f551 Add external macro guard and test middle MSRV 2022-06-23 16:49:31 -04:00
Evan Typanski
92704b494a Split constant check functions and simplify 2022-06-23 10:35:14 -04:00
xFrednet
4182803b86
Check for --force-warn in Clippy's driver run condition 2022-06-23 13:57:22 +02:00
Samuel E. Moelius III
87eded6500 Fix extra_unused_lifetimes false positive 2022-06-22 20:21:04 -04:00
bors
2cc5211584 Auto merge of #9034 - alex-semenyuk:example_vec_resize_to_zero, r=giraffate
Example for VEC_RESIZE_TO_ZERO

changelog: none

Example for VEC_RESIZE_TO_ZERO - what we should use instead
2022-06-22 23:59:16 +00:00
bors
6985e6592b Auto merge of #9028 - kyoto7250:issue_8798, r=xFrednet
confirm  using chain in collapsible_span_lint_calls

close #8798

This PR fixes false positive when using chain in `collapsible_span_lint_calls`.

changelog: None
2022-06-22 22:35:21 +00:00
bors
3d366fc2d8 Auto merge of #9026 - hellow554:neg_multiply_precedence, r=xFrednet
put parentheses around neg_multiply suggestion if needed

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: [`neg_multiply`]: put parentheses around suggestion if needed
2022-06-22 22:18:08 +00:00
Evan Typanski
0447cc7aff Simplify with let else 2022-06-22 15:26:08 -04:00
Evan Typanski
61e1870aff Add MSRV check for const rem_euclid 2022-06-22 14:23:04 -04:00
Evan Typanski
90f8277fe3 Fix case for function params 2022-06-22 14:23:04 -04:00
Evan Typanski
c8df6d6970 Prefer if let chain over macro 2022-06-22 14:23:04 -04:00
Evan Typanski
93e41d3305 Fix case where rem was considered commutative 2022-06-22 14:23:04 -04:00
Evan Typanski
75ed0c9f26 Prefer .ok()? over .unwrap() 2022-06-22 13:15:35 -04:00
alexey semenyuk
b969326874
Example for VEC_RESIZE_TO_ZERO 2022-06-22 11:01:52 +00:00
bors
f9fea1737e Auto merge of #9030 - Serial-ATA:remove-clippy-dev-dep, r=flip1995
Remove `cargo_dev` dependency

changelog: none

Sorry about that 😅.

r? `@flip1995`
2022-06-22 08:02:54 +00:00
bors
bc0bf06718 Auto merge of #9017 - alex-semenyuk:while_let_on_iterator_doc_fix, r=giraffate
Example for `WHILE_LET_ON_ITERATOR`

changelog: none

example for `WHILE_LET_ON_ITERATOR`, using `for` instead of `while let`
2022-06-22 00:01:49 +00:00
kyoto7250
ab645bb081 enum_variant_names should ignore when all prefixes are _ 2022-06-22 08:32:54 +09:00
Evan Typanski
6e1df4732b Fix case where suggestion errored for infer type 2022-06-21 16:41:36 -04:00
Evan Typanski
e5ebd3edab Implement manual_rem_euclid lint 2022-06-21 14:13:15 -04:00
Serial
890fd0e3c1 Remove cargo_dev dependency 2022-06-21 14:04:37 -04:00
alexey semenyuk
dc7f227593 For example should be used instead while in WHILE_LET_ON_ITERATOR
`For` example should be used instead `while` in WHILE_LET_ON_ITERATOR

For example should be used instead while in WHILE_LET_ON_ITERATOR

Revert some changes

Fix cargo dev fmt
2022-06-21 10:40:19 +03:00
Marcel Hellwig
6fc84d4da3 put parentheses around neg_multiply suggestion if needed 2022-06-20 23:47:53 +02:00
bors
93c6f9ebed Auto merge of #9006 - kyoto7250:issue-8836-v2, r=Jarcho
feat(fix): ignore `todo!` and `unimplemented!` in `if_same_then_else`

close: #8836
take over:  #8853

This PR adds  check `todo!` and `unimplemented!` in if_same_then_else.
( I thought `unimplemented` should not be checked as well as todo!.)

Thank you in advance.

changelog: ignore todo! and unimplemented! in if_same_then_else

r? `@Jarcho`
2022-06-20 15:08:32 +00:00
bors
97d451397d Auto merge of #9025 - Alexendoo:unused-async-method, r=dswij
unused_async: lint async methods

Now lints:

```rust
impl Foo {
    async fn method(&self) -> &'static str {
        "no await here"
    }
}
```

changelog: [`unused_async`]: lint async methods

Fixes #9024
2022-06-20 13:10:52 +00:00
Alex Macleod
a0b107bbb6 unused_async: lint async methods 2022-06-20 12:03:27 +00:00
bors
195f2cba45 Auto merge of #9023 - unvalley:add-meta-tag-for-lint-list, r=xFrednet
Add description meta tag for lint list

closes #8975

changelog:none
2022-06-20 10:16:08 +00:00
kyoto7250
4a4b5cf061 confirm using chain in collapsible_span_lint_calls 2022-06-20 13:17:54 +09:00
kyoto7250
39ffda014d check macro in HitEqInterExpr 2022-06-20 11:14:52 +09:00
kyoto7250
46d056e2eb check last statement 2022-06-20 11:05:40 +09:00
bors
9d92af76b4 Auto merge of #9016 - Alexendoo:needless-return-test, r=giraffate
Use `RefCell` in `needless_return` tests

changelog: none

The stdio locks no longer fail to compile if the `return` is removed due to them now being `'static` (#9008)
2022-06-20 00:43:06 +00:00