Commit graph

16793 commits

Author SHA1 Message Date
Centri3
4ff1cd365d add description and rename msrv tests 2023-05-16 11:20:00 -05:00
Catherine
f6a0437e74
Update clippy_lints/src/casts/ptr_cast_constness.rs
Co-authored-by: llogiq <bogusandre@gmail.com>
2023-05-15 13:14:45 -05:00
Centri3
c5a914b181 check msrv 2023-05-14 19:31:12 -05:00
Centri3
8c191add87 the implementation!! 2023-05-14 19:25:23 -05:00
bors
590c9fc108 Auto merge of #10778 - Centri3:type-alias-fix, r=llogiq
Don't emit clippy::useless_conversion on type aliases

Fixes #10773

changelog: Enhancement: [`useless_conversion`]: Don't lint on type aliases
2023-05-14 20:24:27 +00:00
Centri3
a36d9a7820 move is_ty_alias to clippy_utils 2023-05-14 12:39:08 -05:00
Centri3
1190c02bb8 fix #10773 2023-05-14 12:21:23 -05:00
bors
a167973e81 Auto merge of #10768 - c410-f3r:arith-3, r=Jarcho
[arithmetic_side_effects] Consider referenced allowed or hard-coded types

Fix #10767

```
changelog: [`arithmetic_side_effects`]: Do not fire when dealing with allowed or hard-coded types that are referenced.
```
2023-05-14 04:41:41 +00:00
Caio
891fffef0c Consider referenced allowed or hard-coded types 2023-05-13 23:24:33 -03:00
bors
fff790b659 Auto merge of #10691 - jdswensen:jds/fix-doc-empty-line, r=Jarcho
fix: warn on empty line outer AttrKind::DocComment

changelog: [`empty_line_after_doc_comments`]: add lint for checking empty lines after rustdoc comments.

Fixes: #10395
2023-05-12 16:39:02 +00:00
bors
6cbd7679ed Auto merge of #10772 - giraffate:update_actions_setup-node, r=flip1995
Update actions/setup-node

Follow up of https://github.com/rust-lang/rust-clippy/pull/10771. One warning remains: https://github.com/rust-lang/rust-clippy/actions/runs/4959567213

changelog: none
2023-05-12 14:07:54 +00:00
Takayuki Nakata
fce41cef7f Update actions/setup-node 2023-05-12 23:05:20 +09:00
bors
035c45727e Auto merge of #10771 - giraffate:update_actions_checkout, r=flip1995
Update actions/checkout

Suppress the warning in GitHub Actions: https://github.com/rust-lang/rust-clippy/actions/runs/4941438718

changelog: none
2023-05-12 13:46:43 +00:00
Takayuki Nakata
8100a8843b Update actions/checkout 2023-05-12 22:39:33 +09:00
bors
3d456ce5b0 Auto merge of #10769 - Icxolu:manual_next_back, r=giraffate
add lint `manual_next_back`

changelog: [`manual_next_back`]: checks for manual reverse iteration (`.rev().next()`) of a `DoubleEndedIterator`

fixes #10274
2023-05-12 13:34:15 +00:00
Icxolu
a8834bc46a add lint manual_next_back
checks for manual reverse iteration (`.rev().next()`) of a
`DoubleEndedIterator`
2023-05-11 22:25:14 +02:00
Jake Swensen
0a4cfbf1f8 fix: warn on empty line outer AttrKind::DocComment
changelog: [`empty_line_after_doc_comments`]: add lint for checking
empty lines after rustdoc comments.

Fixes: #10395
2023-05-10 20:41:23 -05:00
bors
c56dd3d4c0 Auto merge of #10766 - samueltardieu:issue-10710, r=Manishearth
needless_bool: do not simplify code if it loses comments

Fix #10710

changelog: [`needless_bool`]: do not simplify code if it loses comments
2023-05-10 21:20:33 +00:00
Samuel "Sam" Tardieu
c5d4b04dd5 needless_bool: do not simplify code if it loses comments 2023-05-10 21:19:24 +02:00
bors
1407c7627e Auto merge of #10751 - blyxyas:explain_with_config, r=xFrednet
Add configuration options to `--explain`

This PR rearranges some modules, taking `metadata_collector` out of `internal_lints` and making public just the necessary functions for `explain()` to use.

The output looks something like this:
```sh
$ cargo run --bin cargo-clippy --manifest-path ../rust-clippy/Cargo.toml -- --explain cognitive_complexity
### What it does
Checks for methods with high cognitive complexity.

### Why is this bad?
Methods of high cognitive complexity tend to be hard to
both read and maintain. Also LLVM will tend to optimize small methods better.

### Known problems
Sometimes it's hard to find a way to reduce the
complexity.

### Example
You'll see it when you get the warning.

========================================
Configuration for clippy::cognitive_complexity:
- cognitive-complexity-threshold: The maximum cognitive complexity a function can have (default: 25)
```

Fixes #9990
r? `@xFrednet`

---

changelog: Docs: `cargo clippy --explain LINT` now shows possible configuration options for the explained lint
[#10751](https://github.com/rust-lang/rust-clippy/pull/10751)
<!-- changelog_checked -->
2023-05-09 18:41:30 +00:00
blyxyas
3e8fea612d
Fix config formatting, less indenting, more spacing 2023-05-09 20:35:03 +02:00
bors
77e4d7a839 Auto merge of #10727 - john-h-k:lint/dup-auto-traits, r=Manishearth
Extend `trait_duplication_in_bounds` to cover trait objects

This PR extends `trait_duplication_in_bounds` to cover trait objects.

Currently,
```rs
fn foo(_a: &(dyn Any + Send + Send)) {}
```

generates no warnings. With this PR, it will complain about a duplicate trait and can remove it

Moved from rust-lang/rust#110991

changelog: [`trait_duplication_in_bounds`]: warn on duplicate trait object constraints
2023-05-09 13:46:18 +00:00
John Kelly
b169bdb732 Comments 2023-05-09 10:06:38 +01:00
bors
b4075e87bb Auto merge of #10735 - alnoki:patch-1, r=dswij
Bump README copyright

changelog: none
2023-05-08 18:28:34 +00:00
bors
d696f3b652 Auto merge of #10584 - blyxyas:fix-wildcard_imports_testsrs, r=flip1995
fix: `wildcard_imports` ignore `test.rs` files

Adds a check to see if the building crate is a test one, if so, ignore it

---

Closes #10580
changelog:[`wildcard_imports`]: Add a check to ignore files named `test.rs` and `tests.rs`
2023-05-08 16:46:23 +00:00
blyxyas
4c3e2ff2a4
Fix header 2023-05-08 18:38:41 +02:00
bors
90ce1a2e7c Auto merge of #10761 - lochetti:fix_9871, r=Manishearth
Ignore `borrow_deref_ref` warnings in code from procedural macros.

Don't linting `borrow_deref_ref` if code was generated by procedural macro.

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

changelog: [`borrow_deref_ref`] avoiding warnings in macro-generated code
2023-05-08 16:29:02 +00:00
blyxyas
ba0e7e88cb
Now the lint ignores any crates with --cfg test 2023-05-08 18:24:59 +02:00
blyxyas
5acc2993e7
Really mini minor irrelevant change for formatting 2023-05-08 18:24:59 +02:00
blyxyas
54912410c7
Wildcard_imports ignore test.rs files 2023-05-08 18:24:58 +02:00
bors
e66488a669 Auto merge of #10757 - cakebaker:add_missing_word, r=Jarcho
Add missing word "are"

changelog: none
2023-05-08 15:43:18 +00:00
bors
8798c66a9e Auto merge of #10736 - NotAPenguin0:master, r=Alexendoo
initial clippy::ref_pattern implementation

This implements a new lint that discourages the use of the `ref` keyword as outlined in #9010. I think there are still some things to improve about this lint, but I need some feedback before I can implement those.

- [x] ~~Maybe it's desirable that a quick fix is listed too, instead of a generic `avoid using the ref keyword` lint.~~
- [x] `let ref x = y` already has a lint (`clippy::toplevel_ref_arg`). This implementation will report this too, so you get two lints for the same issue, which is not great. I don't really know a way around this though.
- [X] The dogfood test is currently failing locally, though I ran `cargo clippy -- -D clippy::all -D clippy::pedantic` and got no output, so I'm not sure why this is.

Any help with these would be greatly appreciated.

fixes #9010
changelog: [`ref_pattern`]: newly added lint
2023-05-08 12:24:56 +00:00
NotAPenguin
56e8e1a27d new lint: clippy::ref_patterns 2023-05-08 13:20:33 +02:00
bors
3aab0ddc43 Auto merge of #10752 - Alexendoo:default-units-macros, r=giraffate
Ignore expressions from macros in `default_constructed_unit_structs`

changelog: none, should be the same release as the lint itself
2023-05-08 00:21:43 +00:00
Renato Lochetti
394b4c1906
Ignore borrow_deref_ref warnings in code from procedural macros. 2023-05-07 12:35:17 +01:00
John Kelly
5c8a00923b Comments 2023-05-07 10:10:44 +01:00
Daniel Hofstetter
f4b8cb1b28
Add missing word "are" 2023-05-06 16:21:45 +02:00
blyxyas
2a4571d959
Minimizing changes 2023-05-06 08:38:47 +02:00
Alex Macleod
68eb864c91 Ignore expressions from macros in default_constructed_unit_structs 2023-05-05 18:35:54 +00:00
bors
371120bdbf Auto merge of #10749 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-05-05 15:30:22 +00:00
Philipp Krones
79656cc95e
Bump nightly version -> 2023-05-05 2023-05-05 17:29:40 +02:00
Philipp Krones
88c7632659
Merge remote-tracking branch 'upstream/master' into rustup 2023-05-05 17:29:35 +02:00
bors
d7173e2599 Auto merge of #10747 - Alexendoo:cargo-dev-dogfood-stdout, r=flip1995
Inherit stdout/stderr for `cargo dev dogfood`

changelog: none

Prints progress as it happens and in colour, and will also show anything printed to stderr
2023-05-05 12:22:25 +00:00
Alex Macleod
0f7b61d729 Inherit stdout/stderr for cargo dev dogfood 2023-05-05 12:10:36 +00:00
bors
8518391e72 Auto merge of #110806 - WaffleLapkin:unmkI, r=lcnr
Replace `tcx.mk_trait_ref` with `TraitRef::new`

First step in implementing https://github.com/rust-lang/compiler-team/issues/616
r? `@lcnr`
2023-05-04 05:54:09 +00:00
bors
f9c1d155b4 Auto merge of #10716 - Icxolu:unitstruct_default_construction, r=Manishearth
Fixes #10609: Adds lint to detect construction of unit struct using `default`

Using `default` to construct a unit struct increases code complexity and adds a function call. This can be avoided by simply removing the call to `default` and simply construct by name.

changelog: [`default_constructed_unit_structs`]: detects construction of unit structs using `default`

fixes #10609
2023-05-03 21:43:02 +00:00
Icxolu
48ae5a071b fix lint docs 2023-05-03 21:43:10 +02:00
Icxolu
160371550f add rustfix annotation 2023-05-03 21:05:50 +02:00
Icxolu
4ed7fd1ecc fix failing tests 2023-05-03 20:55:14 +02:00
Icxolu
8701009860 add more test cases 2023-05-03 20:55:14 +02:00