Commit graph

14334 commits

Author SHA1 Message Date
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
unvalley
4e7ed42867 Add description meta tag for lint list 2022-06-20 00:19:08 +09:00
Alex Macleod
eeedf72c33 Use RefCell in needless_return tests 2022-06-18 16:36:47 +00:00
kyoto7250
a9215d90c8 ignore item in thread_local! 2022-06-18 21:02:47 +09:00
kyoto7250
4a02ae9636 cargo dev fmt 2022-06-18 18:29:39 +09:00
kyoto7250
040d45e412 check macro in eq_block 2022-06-18 18:24:39 +09:00
kyoto7250
7a83809c8c check only first statement 2022-06-18 17:49:03 +09:00
kyoto7250
f411c18a73 check macro_backtrace only 2022-06-18 17:46:42 +09:00
bors
e933bb6bc3 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.
2022-06-17 21:06:09 +00:00
kyoto7250
697c75ef4b check only the end 2022-06-18 00:19:30 +09:00
kyoto7250
2bb8c45026 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
2022-06-17 21:34:36 +09:00
kyoto7250
a5b6d25ca4 use get_diagnostic_name for checking macro_call 2022-06-17 10:10:40 +09:00
bors
d7b5cbf065 Auto merge of #9007 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2022-06-16 14:07:23 +00:00
flip1995
280797ecb0
Bump nightly version -> 2022-06-16 2022-06-16 16:04:12 +02:00
flip1995
c5c8f6122f
Merge remote-tracking branch 'upstream/master' into rustup 2022-06-16 16:04:06 +02:00
bors
9edd6412f1 Auto merge of #9005 - flip1995:book_ci_2, r=xFrednet
Build mdbook in remark workflow

r? `@xFrednet`

Supersedes #8959

changelog: none
2022-06-16 12:49:20 +00:00
kyoto7250
7cb4cef123 feat(fix): ignore todo! and unimplemented! in if_same_then_else 2022-06-16 21:38:47 +09:00
flip1995
980d88e25c
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
2022-06-16 14:10:35 +02:00
bors
71f2de96ee 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
2022-06-15 18:36:32 +00:00
Dany Marcoux
9306e9a4df Ignore bodies containing todo!() in clippy::if_same_then_else 2022-06-16 00:36:56 +09:00
Yuki Okushi
bd071bf5b2 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``
2022-06-15 19:37:14 +09:00
andylizi
a8370d4460
Fix false positive for never_loop struct expression fields 2022-06-15 18:02:59 +08:00
bors
844c06a7c7 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
2022-06-15 06:16:14 +00:00
bors
32a86c086e 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
2022-06-14 16:54:13 +00:00
Alex Macleod
08cfb8ddc3 Remove error-pattern comments 2022-06-14 16:28:34 +00:00
tamaron
14478bb94b add lint 2022-06-14 23:30:43 +09:00
b-naber
196f3c0e71 fix wrong evaluation in clippy 2022-06-14 16:11:35 +02:00
b-naber
6d94f95a20 address review 2022-06-14 16:11:27 +02:00
b-naber
3f4ad95826 fix clippy test failures 2022-06-14 16:08:11 +02:00
b-naber
90a41050ba implement valtrees as the type-system representation for constant values 2022-06-14 16:07:11 +02:00
bors
5a45805db5 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 😄.

### 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 🎉.
r? `@xFrednet` (?)
2022-06-14 10:42:09 +00:00
bors
c07cbb9ea6 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
2022-06-14 08:59:40 +00:00
bors
c80ca2c1d6 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
2022-06-14 08:33:52 +00:00
Nicholas Nethercote
7969056f6f 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.
2022-06-14 13:06:44 +10:00
Jason Newcomb
cccc750046 Fix clap deprecation warnings 2022-06-13 21:57:17 -04:00
bors
17b7ab004f 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`
2022-06-13 08:21:54 +00:00
Takayuki Maeda
d024997943 remove unnecessary to_string and String::new for tool_only_span_suggestion 2022-06-13 16:01:16 +09:00
Takayuki Maeda
f2d9acfc01 remove unnecessary to_string and String::new 2022-06-13 15:48:40 +09:00
bors
b95ce0eada Auto merge of #8983 - Alexendoo:redundant_closure_tests, r=giraffate
Add tests for some fixed `redundant_closure` issues

closes #7861
closes #5939

changelog: none
2022-06-13 00:14:31 +00:00
xFrednet
c6d04ec20b
Test metadata collection in Bors CI workflow 2022-06-12 16:22:24 +02:00
Camille GILLOT
7b84a97c3e Make ExprKind::Closure a struct variant. 2022-06-12 00:16:27 +02:00
Micha White
ded2bb5464
Slight documentation change 2022-06-10 13:12:03 -04:00
Micha White
f3dc7ae370
Fixed up the documentation for a couple functions 2022-06-10 13:12:03 -04:00
Micha White
01c75e4b98
Added tests for Cow and Result 2022-06-10 13:12:02 -04:00
Micha White
b0c20302b7
Some refactoring 2022-06-10 13:12:02 -04:00
Micha White
b46f1c4a7f
Don't trigger if a binding is in the else pattern 2022-06-10 13:12:02 -04:00
Micha White
2967127de2
Refactored the candidate type checking 2022-06-10 13:12:02 -04:00
Micha White
6d6c63ee23
Lint single_match with Options, Results, and Cows 2022-06-10 13:11:50 -04:00