Commit Graph

17247 Commits

Author SHA1 Message Date
bors
9fa4089410 Auto merge of #10993 - Centri3:iter_nth_zero, r=Manishearth
Don't lint [`iter_nth_zero`] in `next`

Closes #9820
This also *slightlyy* modifies the output of `iter_nth`, as I noticed the types' names weren't in backticks

changelog: [`iter_nth_zero`]: No longer lints in implementations of `Iterator::next`
2023-06-21 22:06:12 +00:00
Centri3
242807a9c1 Don't lint iter_nth_zero in next 2023-06-21 15:58:52 -05:00
bors
b3fd7b8120 Auto merge of #10948 - Centri3:borrow_as_ptr, r=dswij
[`borrow_as_ptr`]: Ignore temporaries

Fixes #9884

changelog: [`borrow_as_ptr`]: Ignore temporaries
2023-06-21 17:07:52 +00:00
bors
b3ae038a80 Auto merge of #11000 - Centri3:doc_markdown, r=giraffate
add WebAssembly to test

r? `@giraffate`
changelog: none
2023-06-21 02:42:49 +00:00
Catherine
3b89984b56 add WebAssembly to test 2023-06-20 21:19:58 -05:00
bors
73e31d12b4 Auto merge of #10999 - Centri3:doc_markdown, r=Alexendoo
Add WebAssembly to allowed idents

Closes #10998
changelog: [`doc_markdown`]: No longer lints WebAssembly
2023-06-21 00:47:29 +00:00
Catherine
e3b601a1aa Add WebAssembly to allowed idents 2023-06-20 18:12:20 -05:00
bors
62972ae2dd Auto merge of #10952 - Centri3:excessive_precision, r=dswij
Don't lint `excessive_precision` on inf

Fixes #9910

changelog: [`excessive_precision`]: No longer lints overflowing literals
2023-06-20 14:56:21 +00:00
bors
5da6174318 Auto merge of #10990 - y21:issue8634-partial, r=blyxyas,xFrednet
[`single_match`]: don't lint if block contains comments

Fixes #8634

It now ignores matches with a comment in the "else" arm

changelog: [`single_match`]: don't lint if block contains comments
2023-06-20 13:57:19 +00:00
bors
8fd021f504 Auto merge of #10986 - Centri3:undocumented_unsafe_blocks, r=Manishearth
Allow safety comment above attributes

Closes #8679

changelog: Enhancement: [`undocumented_safety_block`]: Added `accept-comment-above-attributes` configuration.
2023-06-20 05:04:46 +00:00
Centri3
cc2e49f695 allow safety comment above attributes 2023-06-19 23:46:57 -05:00
bors
1919dff4ee Auto merge of #10989 - ericmarkmartin:use-placeref-abstraction, r=Manishearth
Use placeref abstraction

rust-lang/rust#80647 suggests refactoring certain patterns with MIR places to use higher-level abstractions provided by the [`Place`](https://doc.rust-lang.org/stable/nightly-rustc/rustc_middle/mir/struct.Place.html)/[`PlaceRef`](https://doc.rust-lang.org/stable/nightly-rustc/rustc_middle/mir/struct.PlaceRef.html). While working on that issue, I found a couple candidates for such refactoring in clippy.

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

changelog: none
2023-06-20 04:43:38 +00:00
bors
89294e1756 Auto merge of #10992 - blyxyas:fix-test_case_lib, r=Manishearth
`items_after_test_module`: Ignore in-proc-macros items

The library `test-case` is having some problems with this lint, ignoring proc macros should fix it.
Related to #10713 and frondeus/test-case#122

(Couldn't add test cases for this exact situation without importing the library, but I think the fix is simple enough that we can be pretty sure there won't be any problems :) )

changelog:[`items_after_test_module`]: Ignore items in procedural macros
2023-06-20 04:14:20 +00:00
bors
5b60388e5a Auto merge of #10930 - y21:issue9956, r=blyxyas,xFrednet
[`redundant_closure_call`]: handle nested closures

Fixes #9956.

This ended up being a much larger change than I'd thought, and I ended up having to pretty much rewrite it as a late lint pass, because it needs access to certain things that I don't think are available in early lint passes (e.g. getting the parent expr). I think this'll be required to fi-x #10922 anyway, so this is probably fine.
(edit: had to write "fi-x" because "fix" makes github think that this PR fixes it, which it doesn't 😅 )

Previously, it would suggest changing `(|| || 42)()()` to `|| 42()`, which is a type error (it needs parens: `(|| 42)()`). In my opinion, though, the suggested fix should have really been `42`, so that's what this PR changes.

changelog: [`redundant_closure_call`]: handle nested closures and rewrite as a late lint pass
2023-06-19 20:30:35 +00:00
bors
f396004b25 Auto merge of #10975 - hehaoqian:fix_self_named_module_files, r=Centri3,xFrednet
Fix false positive of [self_named_module_files] and [mod_module_files]

changelog: [self_named_module_files] [mod_module_files]: No longer lints dependencies located in subdirectory of workspace

fixes #8887

---

First time contributor here, just read contribution guide today.

I have several questions:

1. ~Is it the correct way to use environment variable `CARGO_HOME` to get the location of cargo home directory?~
(Edit: Code no longer uses CARGO_HOME)
2. How to setup test for this PR? This involves multiple files and `CARGO_HOME` setup. ~Not sure how to do this.~
~Edit: Working on tests right now~ A workspace_test has been added
2023-06-19 20:14:21 +00:00
bors
c8c03ea606 Auto merge of #10793 - c410-f3r:bbbbbbbbbbb, r=xFrednet
[`arithmetic_side_effects`] Fix #10792

Fix #10792

```
changelog: [`arithmetic_side_effects`]: Retrieve field values of structures that are in constant environments
```
2023-06-19 19:51:49 +00:00
blyxyas
62c9e0b87d
Ignore in-proc-macros items 2023-06-19 20:50:24 +02:00
y21
2e856fa99b add test for block comment and add note to description 2023-06-19 20:07:31 +02:00
bors
ebcbba93ad Auto merge of #10980 - Alexendoo:format-args-incremental-spans, r=dswij
Fix `find_format_arg_expr` when incremental compilation is enabled

Fixes #10969

[`lower_span`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/struct.LoweringContext.html#method.lower_span) gives AST spans a [parent](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/struct.SpanData.html#structfield.parent) when lowering to the HIR. That meant the `==` span comparison would return false even though the spans are pointing to the same thing. We now ignore the parent when comparing the spans

Debugging this was quite the puzzle, because the parent is not included in the debug output of `Span`s or `SpanData` 😬

changelog: none
2023-06-19 17:54:57 +00:00
y21
d7e723441e [single_match]: don't lint if block contains comments 2023-06-19 17:18:27 +02:00
Eric Mark Martin
9bc6e114e0 add non-test-case for suggesting const on functions accessing union fields 2023-06-19 03:44:34 -04:00
Eric Mark Martin
66590ba41b use PlaceRef abstractions 2023-06-19 03:44:04 -04:00
bors
06b444b2d1 Auto merge of #10951 - Centri3:single_call_fn, r=giraffate
new lint [`single_call_fn`]

Closes #10861

changelog: New lint [`single_call_fn`]
2023-06-19 02:37:26 +00:00
hehaoqian
e11ebbd5e7 Move continue into if statement
Co-authored-by: Catherine <114838443+Centri3@users.noreply.github.com>
2023-06-19 08:36:27 +08:00
Centri3
2cd4a9182a Ignore functions annotated with #[test] 2023-06-18 19:32:38 -05:00
hehaoqian
65b93a5b43 Fix false positive of [self_named_module_files] and [mod_module_files] 2023-06-18 09:04:59 +08:00
Centri3
a8605269bd add test for closures 2023-06-17 20:01:15 -05:00
Centri3
07dbcbda12 new lint single_call_fn 2023-06-17 20:01:06 -05:00
Alex Macleod
26e78e72bc Fix find_format_arg_expr when incremental compilation is enabled 2023-06-17 20:55:30 +00:00
Caio
dbe4057237 Dogfood 2023-06-17 17:16:01 -03:00
Caio
0e1caa765e Fix #10792 2023-06-17 17:03:31 -03:00
bors
8c8ff5f31d Auto merge of #10976 - dswij:issue-10966, r=Alexendoo
Make [`missing_panics_doc`]  not lint for `todo!()`

closes #10966

changelog: [`missing_panics_doc`] now does not lint for `todo!()`
2023-06-17 16:40:39 +00:00
dswij
a6346d7c9d missing_panics_in_doc bless test and add additional macro testcase 2023-06-17 23:21:09 +08:00
dswij
1f621af28c Exlude todo!() from missing_panics_in_doc 2023-06-17 23:20:33 +08:00
bors
bb78d76d48 Auto merge of #10886 - lochetti:fix_10832, r=Centri3,xFrednet
Adding configuration to allow safety comment above stmt containing unsafe block

Adding a new configuration, `accept-comment-above-statement`, to allow a safety comment to be placed before the statement that has the `unsafe` block. It affects the `undocumented_unsafe_blocks` lint.

The default value for this configuration will be `false`. So the user has to opt-in for the change.

This PR fixes https://github.com/rust-lang/rust-clippy/issues/10832

---

changelog: Enhancement [`undocumented_unsafe_blocks`]: Added `accept-comment-above-statement` configuration.
[#10886](https://github.com/rust-lang/rust-clippy/pull/10886)
2023-06-17 13:25:03 +00:00
Renato Lochetti
d6102018bf
Collecting metadata 2023-06-17 09:40:51 -03:00
Renato Lochetti
8625a849d1
adding all ui tests to the configuration test as well 2023-06-17 09:36:38 -03:00
Renato Lochetti
e2e6a02445
Addressing reviewer comments 2023-06-17 09:36:38 -03:00
Renato Lochetti
520228b377
Adding configuration to allow safety comment above stmt containing unsafe block 2023-06-17 09:36:36 -03:00
bors
965f4a8492 Auto merge of #10973 - flip1995:fix-version-py-script, r=flip1995
Fix version.py after deleting v* dirs

I missed updating this file.

I also ran black and isort over it.

Fixes the [deployment failure](https://github.com/rust-lang/rust-clippy/actions/runs/5297071588/jobs/9588599397)

r? `@ghost`

changelog: none
2023-06-17 08:07:53 +00:00
Philipp Krones
445f428a65
Fix version.py after deleting v* dirs
I missed updating this file.

I also ran black and isort over it.
2023-06-17 10:05:06 +02:00
bors
baf3680d1b Auto merge of #10876 - flip1995:gh-pages-cleanup-repo, r=flip1995
Adapt versions.html file to cleaned up gh-pages

Companion PR to #10875

changelog: Remove legacy v0.0.* versions from Clippy repository and documentation.

Must be merged together with #10875 (best with a closed tree)

r? `@Alexendoo` (because you were randomly selected on the other PR :P)
2023-06-17 07:37:21 +00:00
Philipp Krones
60b7fde4ad
Adapt versions.html file to cleaned up gh-pages 2023-06-17 09:24:06 +02:00
bors
3217f8aeaa Auto merge of #10942 - Centri3:unnecessary_cast, r=llogiq
Ignore more type aliases in `unnecessary_cast`

This is potentially the worst code I've ever written, and even if not, it's very close to being on par with starb. This will ignore `call() as i32` and `local_obtained_from_call as i32` now.

This should fix every reasonable way to reproduce #10555, but likely not entirely.

changelog: Ignore more type aliases in `unnecessary_cast`
2023-06-16 19:24:11 +00:00
bors
e11f36cc67 Auto merge of #10965 - not-my-profile:explain-status, r=Alexendoo
Make `--explain` subcommand return 1 for missing lints

changelog: The `--explain` subcommand now exits with the 1 exit code for missing lints
2023-06-16 11:28:51 +00:00
Martin Fischer
894d5dafac Make --explain subcommand return 1 for missing lints 2023-06-16 11:53:25 +02:00
Martin Fischer
a94aac607c Refactor to make following commit pass single_match_else lint 2023-06-16 11:53:24 +02:00
bors
43ecf8ea7d Auto merge of #10953 - KisaragiEffective:missing_panics_doc_trigger_on_expect, r=dswij
[`missing_panics_doc`]: pickup expect method

close #10240

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

changelog: [`missing_panics_doc`]: pickup expect method
2023-06-16 09:12:46 +00:00
bors
87b5f89497 Auto merge of #10925 - Centri3:needless_clone_impl2, r=xFrednet
add lint [`incorrect_clone_impl_on_copy_type`]

Split off from #10788.

Closes #10700

----

changelog: new lint [`incorrect_clone_impl_on_copy_type`]
[#10925](https://github.com/rust-lang/rust-clippy/pull/10925)
2023-06-16 08:09:18 +00:00
Kisaragi
73c0c14526
improve grammer in comment sentence
Co-authored-by: dswij <dharmasw@outlook.com>
2023-06-16 16:39:09 +09:00