]>
git.lizzy.rs Git - rust.git/log
bors [Mon, 27 Jun 2022 13:58:26 +0000 (13:58 +0000)]
Auto merge of #8972 - kyoto7250:use_retain, r=llogiq
feat(new lint): new lint `manual_retain`
close #8097
This PR is a new lint implementation.
This lint checks if the `retain` method is available.
Thank you in advance.
changelog: add new ``[`manual_retain`]`` lint
bors [Mon, 27 Jun 2022 13:38:50 +0000 (13:38 +0000)]
Auto merge of #8990 - tsoutsman:master, r=llogiq
Fix `let_undescore_lock` false-positive when binding without locking
Fixes #8486.
changelog: Fix `let_undescore_lock` false-positive when binding without locking.
Klim Tsoutsman [Mon, 13 Jun 2022 03:08:50 +0000 (13:08 +1000)]
Fix `let_undescore_lock` false-positive when binding without locking
Signed-off-by: Klim Tsoutsman <klimusha@gmail.com>
bors [Mon, 27 Jun 2022 06:08:00 +0000 (06:08 +0000)]
Auto merge of #9054 - alex-semenyuk:string_add_example, r=giraffate
STRING_ADD example
changelog: none
STRING_ADD example, how it should be
bors [Mon, 27 Jun 2022 00:32:22 +0000 (00:32 +0000)]
Auto merge of #8871 - Serial-ATA:cargo-dev-deprecate, r=giraffate
Add `cargo dev deprecate`
changelog: none
I wrote this awhile ago when `regex` was still a dependency. Is it alright to add it back?
bors [Mon, 27 Jun 2022 00:05:50 +0000 (00:05 +0000)]
Auto merge of #8939 - Jarcho:transmute_ptr_to_ref_lt, r=giraffate
Suggest `pointer::cast` when possible in `transmute_ptr_to_ref`
fixes #8924
changelog: Suggest casting the pointer for any type containing lifetimes in `transmute_ptr_to_ref`.
changelog: Suggest `pointer::cast` when possible in `transmute_ptr_to_ref`.
kyoto7250 [Sun, 26 Jun 2022 23:20:30 +0000 (08:20 +0900)]
cargo dev update_lints
kyoto7250 [Sat, 18 Jun 2022 09:56:46 +0000 (18:56 +0900)]
fix for git rebase
kyoto7250 [Fri, 10 Jun 2022 12:02:43 +0000 (21:02 +0900)]
rename use_retain => manual_retain
kyoto7250 [Fri, 10 Jun 2022 02:31:25 +0000 (11:31 +0900)]
check msrv
kyoto7250 [Thu, 9 Jun 2022 13:50:00 +0000 (22:50 +0900)]
rewrite without if_chain macro
kyoto7250 [Thu, 9 Jun 2022 13:34:16 +0000 (22:34 +0900)]
check method
kyoto7250 [Thu, 9 Jun 2022 13:25:07 +0000 (22:25 +0900)]
change lint type from style to perf
kyoto7250 [Thu, 9 Jun 2022 13:20:59 +0000 (22:20 +0900)]
remove needless return
kyoto7250 [Thu, 9 Jun 2022 12:52:40 +0000 (21:52 +0900)]
Update clippy_lints/src/use_retain.rs
Co-authored-by: llogiq <bogusandre@gmail.com>
kyoto7250 [Tue, 7 Jun 2022 03:11:33 +0000 (12:11 +0900)]
feat(new lint): new lint `use_retain`
bors [Sun, 26 Jun 2022 16:11:06 +0000 (16:11 +0000)]
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
bors [Sun, 26 Jun 2022 15:07:22 +0000 (15:07 +0000)]
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
kyoto7250 [Sun, 26 Jun 2022 11:19:32 +0000 (20:19 +0900)]
update node.js version
alexey semenyuk [Sun, 26 Jun 2022 08:36:50 +0000 (08:36 +0000)]
STRING_ADD example
alexey semenyuk [Sun, 26 Jun 2022 08:14:37 +0000 (11:14 +0300)]
STRING_ADD example
kyoto7250 [Sun, 26 Jun 2022 07:11:04 +0000 (16:11 +0900)]
use all instead of join
kyoto7250 [Sun, 26 Jun 2022 06:55:44 +0000 (15:55 +0900)]
treat argument as a slice.
Co-authored-by: llogiq <bogusandre@gmail.com>
bors [Sat, 25 Jun 2022 16:48:34 +0000 (16:48 +0000)]
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.
Jason Newcomb [Sat, 4 Jun 2022 02:12:26 +0000 (22:12 -0400)]
Suggest `pointer::cast` when possible in `transmute_ptr_to_ref`
Defensively add a cast to any type with lifetimes.
bors [Sat, 25 Jun 2022 02:40:30 +0000 (02:40 +0000)]
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`
Serial [Fri, 24 Jun 2022 18:11:24 +0000 (14:11 -0400)]
Add test for [`default_deprecation_reason`]
bors [Fri, 24 Jun 2022 17:49:53 +0000 (17:49 +0000)]
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
bors [Fri, 24 Jun 2022 08:39:45 +0000 (08:39 +0000)]
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
bors [Fri, 24 Jun 2022 02:26:35 +0000 (02:26 +0000)]
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
bors [Thu, 23 Jun 2022 22:29:52 +0000 (22:29 +0000)]
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
Evan Typanski [Thu, 23 Jun 2022 20:34:52 +0000 (16:34 -0400)]
Add external macro guard and test middle MSRV
Serial [Thu, 23 Jun 2022 14:37:00 +0000 (10:37 -0400)]
Fix ICE when deprecating lints in directories
Evan Typanski [Thu, 23 Jun 2022 14:35:14 +0000 (10:35 -0400)]
Split constant check functions and simplify
xFrednet [Thu, 23 Jun 2022 07:44:53 +0000 (09:44 +0200)]
Check for `--force-warn` in Clippy's driver run condition
Samuel E. Moelius III [Tue, 21 Jun 2022 09:18:27 +0000 (05:18 -0400)]
Fix `extra_unused_lifetimes` false positive
bors [Wed, 22 Jun 2022 23:59:16 +0000 (23:59 +0000)]
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
bors [Wed, 22 Jun 2022 22:35:21 +0000 (22:35 +0000)]
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
bors [Wed, 22 Jun 2022 22:18:08 +0000 (22:18 +0000)]
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
Evan Typanski [Wed, 22 Jun 2022 19:26:08 +0000 (15:26 -0400)]
Simplify with let else
Evan Typanski [Wed, 22 Jun 2022 18:17:52 +0000 (14:17 -0400)]
Add MSRV check for const rem_euclid
Evan Typanski [Wed, 22 Jun 2022 18:08:47 +0000 (14:08 -0400)]
Fix case for function params
Evan Typanski [Wed, 22 Jun 2022 17:31:04 +0000 (13:31 -0400)]
Prefer if let chain over macro
Evan Typanski [Wed, 22 Jun 2022 17:26:13 +0000 (13:26 -0400)]
Fix case where rem was considered commutative
Evan Typanski [Wed, 22 Jun 2022 17:15:35 +0000 (13:15 -0400)]
Prefer `.ok()?` over `.unwrap()`
alexey semenyuk [Wed, 22 Jun 2022 11:01:52 +0000 (11:01 +0000)]
Example for VEC_RESIZE_TO_ZERO
bors [Wed, 22 Jun 2022 08:02:54 +0000 (08:02 +0000)]
Auto merge of #9030 - Serial-ATA:remove-clippy-dev-dep, r=flip1995
Remove `cargo_dev` dependency
changelog: none
Sorry about that :sweat_smile:.
r? `@flip1995`
bors [Wed, 22 Jun 2022 00:01:49 +0000 (00:01 +0000)]
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`
kyoto7250 [Tue, 21 Jun 2022 22:59:14 +0000 (07:59 +0900)]
enum_variant_names should ignore when all prefixes are _
Evan Typanski [Tue, 21 Jun 2022 20:41:36 +0000 (16:41 -0400)]
Fix case where suggestion errored for infer type
Evan Typanski [Tue, 21 Jun 2022 18:13:15 +0000 (14:13 -0400)]
Implement manual_rem_euclid lint
Serial [Tue, 21 Jun 2022 18:04:37 +0000 (14:04 -0400)]
Remove `cargo_dev` dependency
Serial [Sun, 22 May 2022 19:41:43 +0000 (15:41 -0400)]
Add `dev deprecate`
alexey semenyuk [Sat, 18 Jun 2022 19:42:39 +0000 (19:42 +0000)]
`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
Marcel Hellwig [Mon, 20 Jun 2022 21:44:18 +0000 (23:44 +0200)]
put parentheses around neg_multiply suggestion if needed
bors [Mon, 20 Jun 2022 15:08:32 +0000 (15:08 +0000)]
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`
bors [Mon, 20 Jun 2022 13:10:52 +0000 (13:10 +0000)]
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
Alex Macleod [Mon, 20 Jun 2022 12:03:27 +0000 (12:03 +0000)]
unused_async: lint async methods
bors [Mon, 20 Jun 2022 10:16:08 +0000 (10:16 +0000)]
Auto merge of #9023 - unvalley:add-meta-tag-for-lint-list, r=xFrednet
Add description meta tag for lint list
closes #8975
changelog:none
kyoto7250 [Mon, 20 Jun 2022 04:17:54 +0000 (13:17 +0900)]
confirm using chain in collapsible_span_lint_calls
kyoto7250 [Mon, 20 Jun 2022 02:14:52 +0000 (11:14 +0900)]
check macro in HitEqInterExpr
kyoto7250 [Mon, 20 Jun 2022 02:05:40 +0000 (11:05 +0900)]
check last statement
bors [Mon, 20 Jun 2022 00:43:06 +0000 (00:43 +0000)]
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)
unvalley [Sun, 19 Jun 2022 15:19:08 +0000 (00:19 +0900)]
Add description meta tag for lint list
Alex Macleod [Sat, 18 Jun 2022 16:36:47 +0000 (16:36 +0000)]
Use RefCell in needless_return tests
kyoto7250 [Thu, 16 Jun 2022 14:19:46 +0000 (23:19 +0900)]
ignore item in thread_local!
kyoto7250 [Sat, 18 Jun 2022 09:29:39 +0000 (18:29 +0900)]
cargo dev fmt
kyoto7250 [Sat, 18 Jun 2022 09:24:39 +0000 (18:24 +0900)]
check macro in eq_block
kyoto7250 [Sat, 18 Jun 2022 08:49:03 +0000 (17:49 +0900)]
check only first statement
kyoto7250 [Sat, 18 Jun 2022 08:41:26 +0000 (17:41 +0900)]
check macro_backtrace only
bors [Fri, 17 Jun 2022 21:06:09 +0000 (21:06 +0000)]
Auto merge of #8989 - kyoto7250:default_iter_empty, r=Alexendoo
feat(lint): add default_iter_empty
close #8915
This PR adds `default_iter_empty` lint.
This lint checks `std::iter::Empty::default()` and replace with `std::iter::empty()`.
Thank you in advance.
---
changelog: add `default_instead_of_iter_empty` lint.
kyoto7250 [Fri, 17 Jun 2022 15:19:30 +0000 (00:19 +0900)]
check only the end
kyoto7250 [Sun, 12 Jun 2022 12:30:55 +0000 (21:30 +0900)]
feat(lint): add default_iter_empty
Update description in clippy_lints/src/default_iter_empty.rs
Co-authored-by: Fridtjof Stoldt <xFrednet@gmail.com>
Update clippy_lints/src/default_iter_empty.rs
Co-authored-by: Alex Macleod <alex@macleod.io>
Update clippy_lints/src/default_iter_empty.rs
Co-authored-by: Alex Macleod <alex@macleod.io>
renamed default_iter_empty to default_instead_of_iter_empty
Avoid duplicate messages
add tests for regression
rewrite 'Why is this bad?'
cargo dev fmt
delete default_iter_empty lint in renamed_lint.rs
rewrite a message in the suggestion
cargo dev update_lints --check
kyoto7250 [Fri, 17 Jun 2022 01:10:40 +0000 (10:10 +0900)]
use get_diagnostic_name for checking macro_call
bors [Thu, 16 Jun 2022 14:07:23 +0000 (14:07 +0000)]
Auto merge of #9007 - flip1995:rustup, r=flip1995
Rustup
r? `@ghost`
changelog: none
flip1995 [Thu, 16 Jun 2022 14:04:12 +0000 (16:04 +0200)]
Bump nightly version -> 2022-06-16
flip1995 [Thu, 16 Jun 2022 13:33:15 +0000 (15:33 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup
bors [Thu, 16 Jun 2022 12:49:20 +0000 (12:49 +0000)]
Auto merge of #9005 - flip1995:book_ci_2, r=xFrednet
Build mdbook in remark workflow
r? `@xFrednet`
Supersedes #8959
changelog: none
kyoto7250 [Thu, 16 Jun 2022 12:29:43 +0000 (21:29 +0900)]
feat(fix): ignore todo! and unimplemented! in if_same_then_else
flip1995 [Thu, 16 Jun 2022 12:10:35 +0000 (14:10 +0200)]
Build mdbook in remark workflow
This is just to ensure that the book builds all time to not get in trouble when syncing with rust-lang/rust
bors [Wed, 15 Jun 2022 18:36:32 +0000 (18:36 +0000)]
Auto merge of #9002 - andylizi:fix-never-loop, r=Manishearth
Fix false positive for `never_loop` struct expression fields
Fixes #9001.
changelog: [`never_loop`]: Now checks for `continue` in struct expression
Dany Marcoux [Wed, 18 May 2022 18:28:11 +0000 (20:28 +0200)]
Ignore bodies containing `todo!()` in `clippy::if_same_then_else`
Yuki Okushi [Wed, 15 Jun 2022 10:37:14 +0000 (19:37 +0900)]
Rollup merge of #98110 - cjgillot:closure-brace, r=Aaron1011
Make `ExprKind::Closure` a struct variant.
Simple refactor since we both need it to introduce additional fields in `ExprKind::Closure`.
r? ``@Aaron1011``
andylizi [Wed, 15 Jun 2022 09:54:43 +0000 (17:54 +0800)]
Fix false positive for `never_loop` struct expression fields
bors [Wed, 15 Jun 2022 06:16:14 +0000 (06:16 +0000)]
Auto merge of #8964 - tamaroning:read_zero_byte_vec, r=dswij
Warn about read into zero-length `Vec`
Closes #8886
- \[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: none
bors [Tue, 14 Jun 2022 16:54:13 +0000 (16:54 +0000)]
Auto merge of #8999 - Alexendoo:error-pattern, r=xFrednet
Remove error-pattern comments
The `clippy_lints` one [is unused](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/.60error-pattern.60), the others in `ui-toml` also appear not to have an effect
changelog: none
Alex Macleod [Tue, 14 Jun 2022 16:28:34 +0000 (16:28 +0000)]
Remove error-pattern comments
tamaron [Mon, 6 Jun 2022 13:48:05 +0000 (22:48 +0900)]
add lint
b-naber [Fri, 3 Jun 2022 19:41:01 +0000 (21:41 +0200)]
fix wrong evaluation in clippy
b-naber [Fri, 3 Jun 2022 18:42:35 +0000 (20:42 +0200)]
address review
b-naber [Thu, 2 Jun 2022 13:15:01 +0000 (15:15 +0200)]
fix clippy test failures
b-naber [Wed, 16 Feb 2022 09:56:01 +0000 (10:56 +0100)]
implement valtrees as the type-system representation for constant values
bors [Tue, 14 Jun 2022 10:42:09 +0000 (10:42 +0000)]
Auto merge of #8947 - Serial-ATA:lint-produces-output, r=xFrednet
Add lint output to lint list
changelog: Add the ability to show the lint output in the lint list
This just adds the logic to produce the output, it hasn't been added to any lints yet. It did help find some mistakes in some docs though :smile:.
### Screenshots
<details>
<summary>A single code block</summary>
![single-code-block](https://user-images.githubusercontent.com/
69764315 /
172013766 -
145b22b1 -1d91-4fb8-9cd0-
b967a52d6330 .png)
</details>
<details>
<summary>A single code block with a "Use instead" section</summary>
![with-usage](https://user-images.githubusercontent.com/
69764315 /
172013792 -
d2dd6c9c -defa-41e0-8c27-
8e8e311adb63 .png)
</details>
<details>
<summary>Multiple code blocks</summary>
![multi-code-block](https://user-images.githubusercontent.com/
69764315 /
172013808 -
5328f59b -e7c5-4914-a396-
253822a6d350 .png)
</details>
This is the last task in #7172 :tada:.
r? `@xFrednet` (?)
bors [Tue, 14 Jun 2022 08:59:40 +0000 (08:59 +0000)]
Auto merge of #8901 - Jarcho:sharing_code, r=dswij
Rework `branches_sharing_code`
fixes #7378
This changes the lint from checking pairs of blocks, to checking all the blocks at the same time. As such there's almost none of the original code left.
changelog: Don't lint `branches_sharing_code` when using different binding names
bors [Tue, 14 Jun 2022 08:33:52 +0000 (08:33 +0000)]
Auto merge of #8997 - Jarcho:clap_deprecate, r=flip1995
Fix `clap` deprecation warnings
Clap `3.2.0` deprecated a few functions used by lintcheck.
changelog: None
Nicholas Nethercote [Fri, 10 Jun 2022 01:18:06 +0000 (11:18 +1000)]
Rename the `ConstS::val` field as `kind`.
And likewise for the `Const::val` method.
Because its type is called `ConstKind`. Also `val` is a confusing name
because `ConstKind` is an enum with seven variants, one of which is
called `Value`. Also, this gives consistency with `TyS` and `PredicateS`
which have `kind` fields.
The commit also renames a few `Const` variables from `val` to `c`, to
avoid confusion with the `ConstKind::Value` variant.
Jason Newcomb [Tue, 14 Jun 2022 01:10:30 +0000 (21:10 -0400)]
Fix `clap` deprecation warnings
bors [Mon, 13 Jun 2022 08:21:54 +0000 (08:21 +0000)]
Auto merge of #8988 - xFrednet:8947-test-monster-in-bors-ci, r=flip1995
Test metadata collection in Bors CI workflow
This PR adds a new check to bors CI workflows, which ensures that the metadata collection success, when it's run as part of the `deploy` script. I've only added it to bors workflows, as the runtime will be high while it'll also succeed most of the time. This is a preparation for rust-lang/rust-clippy#8947.
---
changelog: none
r? `@ghost`
Takayuki Maeda [Mon, 13 Jun 2022 07:01:16 +0000 (16:01 +0900)]
remove unnecessary `to_string` and `String::new` for `tool_only_span_suggestion`
Takayuki Maeda [Mon, 13 Jun 2022 06:48:40 +0000 (15:48 +0900)]
remove unnecessary `to_string` and `String::new`