Commit Graph

1062 Commits

Author SHA1 Message Date
y21
f74ec6b1b8 new lint: missing_field_in_debug
move some strings into consts, more tests

s/missing_field_in_debug/missing_fields_in_debug

dont trigger in macro expansions

make dogfood tests happy

minor cleanups

replace HashSet with FxHashSet

replace match_def_path with match_type

if_chain -> let chains, fix markdown, allow newtype pattern

fmt

consider string literal in `.field()` calls as used

don't intern defined symbol, remove mentions of 'debug_tuple'

special-case PD, account for field access through `Deref`
2023-05-31 23:52:02 +02:00
Fridtjof Stoldt
7dd0ae0262
Change changelog typos
Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2023-05-29 18:54:58 +02:00
xFrednet
4d9303df18
Changelog for Rust 1.70 🔨 2023-05-29 12:00:59 +02:00
bors
a0fd17d3f0 Auto merge of #10779 - Centri3:ptr_cast_constness, r=llogiq
Add new lint `ptr_cast_constness`

This adds a new lint which functions as the opposite side of the coin to `ptr_as_ptr`. Rather than linting only as casts that don't change constness, this lints only constness; suggesting to use `pointer::cast_const` or `pointer::cast_mut` instead.

changelog: new lint [`ptr_cast_constness`]
2023-05-23 21:40:50 +00:00
Samuel "Sam" Tardieu
e6646eb5fd needless_else: new lint to check for empty else clauses 2023-05-22 11:52:26 +02:00
Guillaume Gomez
5328852ad7 Update CHANGELOG 2023-05-19 16:16:37 +02:00
Centri3
8c191add87 the implementation!! 2023-05-14 19:25:23 -05: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
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
NotAPenguin
56e8e1a27d new lint: clippy::ref_patterns 2023-05-08 13:20:33 +02:00
Philipp Krones
88c7632659
Merge remote-tracking branch 'upstream/master' into rustup 2023-05-05 17:29:35 +02: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
4e04903631 rename to plural form 2023-05-03 19:25:25 +02:00
y21
8d8178f931 rename lint to manual_while_let_some 2023-04-29 18:59:07 +02:00
y21
bb58083ce5 new lint: while_pop_unwrap 2023-04-29 18:59:06 +02:00
Icxolu
9428138562 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.
2023-04-26 21:12:59 +02:00
xFrednet
637d10b292
Catching, stray, commas, (I'll, never, learn, to, use, them, correctly) 😅 2023-04-25 17:33:27 +02:00
bors
7a870aef1a Auto merge of #10432 - samueltardieu:issue-10430, r=Manishearth
New lint: detect `if` expressions with simple boolean assignments to the same target

Closes #10430

changelog: [`needless_bool_assign`] new lint to detect simple boolean assignment to the same target in `if` branches
2023-04-23 15:47:00 +00:00
Samuel Tardieu
69da902f41 Detect if expressions with boolean assignments to the same target 2023-04-23 13:44:49 +02:00
Philipp Krones
a1b75c5108 Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup 2023-04-23 13:28:56 +02:00
blyxyas
0354cee137
Add lint items_after_test_module 2023-04-22 21:12:45 +02:00
xFrednet
6ce346c942
Changelog for Rust 1.69 🌸 2023-04-19 16:37:28 +02:00
Philipp Krones
6b95029f17 Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup 2023-04-11 15:31:08 +02:00
y21
5d01e6e96c new lint: suspicious_doc_comments 2023-04-07 12:04:55 +02:00
Michael Schubart
b66aa09b95 Add [manual_slice_size_calculation] 2023-04-06 11:48:20 +01:00
blyxyas
b2856a763e
Add tests_outside_test_module lint 2023-04-02 00:35:46 +02:00
Samuel "Sam" Tardieu
6601d85c22 Flag bufreader.lines().filter_map(Result::ok) as suspicious 2023-03-31 14:43:30 +02:00
bors
799732cbd8 Auto merge of #10414 - csmoe:large-future, r=xFrednet
add large future lint

Closes #5263

---

changelog: new lint: [`large_futures`]
[#10414](https://github.com/rust-lang/rust-clippy/pull/10414)
<!-- changelog_checked -->
2023-03-30 08:51:29 +00:00
bors
ef3867f394 Auto merge of #9102 - botahamec:unused-box, r=xFrednet
Added the `[unnecessary_box_returns]` lint

fixes #5

I'm not confident in the name of this lint. Let me know if you can think of something better

---

changelog: New lint: ``[`unnecessary_box_returns`]``
[#9102](https://github.com/rust-lang/rust-clippy/pull/9102)
<!-- changelog_checked -->
2023-03-30 08:22:16 +00:00
Micha White
022f76d432
Added the new lint with some docs and tests 2023-03-26 17:49:46 -04:00
bluthej
1d168b31c3
Merge branch 'rust-lang:master' into clear-with-drain 2023-03-26 19:11:38 +02:00
Philipp Krones
8df896c076 Merge commit 'd5e2a7aca55ed49fc943b7a07a8eba05ab5a0079' into clippyup 2023-03-24 14:26:19 +01:00
Samuel "Sam" Tardieu
d7d3dbf060 New lint: detect unnecessary struct building 2023-03-23 20:56:45 +01:00
bluthej
7f44530f54 Create clear_with_drain lint 2023-03-21 22:51:51 +01:00
csmoe
4fdae81c70 add large future lint 2023-03-20 22:51:01 +08:00
Samuel "Sam" Tardieu
ffabdab8cf New lint to detect &std::path::MAIN_SEPARATOR.to_string() 2023-03-16 21:42:04 +01:00
blyxyas
4b9cb857f9
Rename lint 2023-03-15 23:18:25 +01:00
blyxyas
0f1474ea27
Add allow_attribute lint 2023-03-11 00:30:30 +01:00
Philipp Krones
c34d04a3dd
Update changelog for beta-accepted labels 2023-03-10 11:28:10 +01:00
Philipp Krones
cf8a67d9ad Merge commit '3c06e0b1ce003912f8fe0536d3a7fe22558e38cf' into clippyup 2023-03-10 10:53:50 +01:00
xFrednet
7ce9ca0508
Mark Rust 1.68.0 as release in the changelog 2023-03-09 23:09:51 +01:00
blyxyas
ca3bf94c43
Add let_with_type_underscore lint 2023-03-09 17:18:03 +01:00
Samuel Tardieu
d5429eab8a Add new redundant_async_block lint 2023-03-08 10:48:54 +01:00
Burak Varlı
ea2547b8c6 Add missing_assert_message lint
Co-authored-by: Weihang Lo <me@weihanglo.tw>
2023-03-08 08:50:21 +00:00
bors
41fa24cef8 Auto merge of #10415 - schubart:collection_is_never_read, r=llogiq
Add `collection_is_never_read`

Fixes #9267

`@flip1995` and `@llogiq,` I talked with you about this one at Rust Nation in London last week. :-)

This is my first contribution to Clippy, so lots of feedback would be greatly appreciated.

- \[ ] 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`

`dogfood` found one true positive (see #9509) and no false positives.

`lintcheck` found no (true or false) positives, even when running on an extended set of crates.

---

changelog: new lint [`collection_is_never_read`]
[#10415](https://github.com/rust-lang/rust-clippy/pull/10415)
<!-- changelog_checked -->
2023-03-07 13:35:07 +00:00
xFrednet
917ebc3af6
Changelog for Rust 1.68 🐶 2023-02-28 22:06:53 +01:00
Michael Schubart
2a9c254e23 Add collection_is_never_read 2023-02-27 07:14:55 +00:00
Jason Newcomb
0413fb35ba Merge commit '149392b0baa4730c68f3c3eadf5c6ed7b16b85a4' into clippyup 2023-02-25 19:28:50 -05:00
Krishna Sundarram
00c294ad05 Add new lint no_mangle_with_rust_abi 2023-02-23 17:35:06 +00:00