Commit Graph

14492 Commits

Author SHA1 Message Date
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
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
Serial
2bd1581bbf Add dev deprecate 2022-06-21 13:43:47 -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
Preston From
2476100c85 Add details about significant drop in match scrutinees causing deadlocks
Adds more details about how a significant drop in a match scrutinee can
cause a deadlock and include link to documentation. Emits messages
indicating temporaries with significant drops in arms of matches and
message about possible deadlocks/unexpected behavior.

changelog: Add more details to significant drop lint to explicitly show
how temporaries in match scrutinees can cause deadlocks/unexpected
behavior.
2022-06-20 23:59:15 -06: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
Maybe Waffle
ee37029afa remove last use of MAX_SUGGESTION_HIGHLIGHT_LINES 2022-06-20 00:25:07 +04:00