Commit graph

14509 commits

Author SHA1 Message Date
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
alexey semenyuk
16919143e4
STRING_ADD example 2022-06-26 08:36:50 +00:00
alexey semenyuk
4065702b1f
STRING_ADD example 2022-06-26 11:14:37 +03: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
xFrednet
3a31ef7456
Give clippy some Dogfood to make it happy =^.^= 2022-06-25 14:53:54 +02:00
xFrednet
4d41a97735
Add note to is_lint_allowed about lint emission 2022-06-25 14:37:52 +02:00
xFrednet
6427ba4855
Fix #[expect] for clippy::manual_non_exhaustive 2022-06-25 14:37:51 +02:00
xFrednet
525f5ee7ac
Update useless_attribute docs and allow macro_use_imports 2022-06-25 14:37:51 +02:00
xFrednet
ae4900c9b8
Fix #[expect] for clippy::macro_use_imports 2022-06-25 14:37:50 +02:00
xFrednet
79fc2716dc
Fix #[expect] for unnecessary_unwrap, panicking_unwrap 2022-06-25 14:21:24 +02:00
xFrednet
bdc6ece1b6
Fix #[expect] for clippy::needless_return 2022-06-25 14:16:31 +02:00
xFrednet
54ad99b6e5
Fix #[expect] for clippy::implicit_return 2022-06-25 14:16:31 +02:00
xFrednet
b2976980b5
Fix #[expect] for clippy::boxed_local 2022-06-25 14:16:30 +02:00
xFrednet
b6ee6bba4c
Fix #[expect] for clippy::nonminimal_bool 2022-06-25 14:16:30 +02:00
xFrednet
a3c7101f61
Fix #[expect] for clippy::logic_bug 2022-06-25 14:16:30 +02:00
xFrednet
811d73a2b7
Test #[expect] for redundant_clone 2022-06-25 14:16:29 +02:00
xFrednet
e7c55a478f
Fix #[expect] for clippy::ptr_arg 2022-06-25 14:16:28 +02:00
Jason Newcomb
7cdaabc9b7 Suggest pointer::cast when possible in transmute_ptr_to_ref
Defensively add a cast to any type with lifetimes.
2022-06-25 07:55:30 -04: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
Serial
aec465cabd Add test for [default_deprecation_reason] 2022-06-24 14:11:24 -04: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
dswij
a8f68240d3 Add test for extra_unused_lifetimes FP on derive
This commit adds test for a `extra_unused_lifetimes` false positive from derive (#9014).

The fix for the FP is introduced in #9037.
2022-06-24 18:07:59 +08: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
Serial
d42af68e03 Add cargo dev dogfood 2022-06-23 12:16:34 -04:00
Serial
ebf77f6d7e Fix ICE when deprecating lints in directories 2022-06-23 10:44:11 -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
Preston From
1f707db0bf Update messages for clarity when linting 2022-06-22 22:34:49 -06: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