Commit Graph

16564 Commits

Author SHA1 Message Date
bors
d9c2957221 Auto merge of #10629 - Alexendoo:as-ptr-cast-mut-docs-ub, r=Jarcho
Fix UB in `as_ptr_cast_mut` documentation

changelog: none

Fixes #10628

There's no `String::as_mut_ptr` surprisingly, so the example is actually calling `str::as_mut_ptr` on an empty `str`
2023-04-12 16:47:34 +00:00
bors
d2f1b2c052 Auto merge of #10638 - bluthej:standardize-lint-formulation, r=Alexendoo
Standardize lint formulation

Fixes #10631

changelog: Standardize a very frequent lint formulation which had variations
2023-04-12 16:34:12 +00:00
bluthej
6409556926 Standardize lint formulation 2023-04-12 13:48:03 +02:00
bors
0d06001449 Auto merge of #10621 - fee1-dead-contrib:bump_syn, r=flip1995
bump syn to 2.0

changelog: none
2023-04-12 08:27:12 +00:00
Deadbeef
d406f653c9 bless test error 2023-04-12 09:06:51 +08:00
Deadbeef
3813b8e10d Update ui tests auxiliary to syn 2.0 2023-04-12 08:51:11 +08:00
bors
2a774bb2c7 Auto merge of #10627 - schubart:collection_is_never_read_all_types, r=xFrednet
Test all types supported by [`collection_is_never_read`]

changelog: none
2023-04-11 19:51:06 +00:00
bors
83e42a2337 Auto merge of #10630 - flip1995:book-link-fix, r=xFrednet
Fix links in Clippy book

Links to README.md files must actually be links to index.md files,
because of the inner workings of `mdbook`.

Also use the latest mdbook version in CI.

---

Blocks https://github.com/rust-lang/rust/pull/110003#issuecomment-1500249457

changelog: none
2023-04-11 13:16:06 +00:00
Philipp Krones
0266a9e9a3
Fix links in Clippy book
Links to README.md files must actually be links to index.md files,
because of the inner workings of `mdbook`.

Also use the latest mdbook version in CI.
2023-04-11 14:43:47 +02:00
Alex Macleod
8f979af3d1 Fix UB in as_ptr_cast_mut documentation 2023-04-11 11:17:18 +00:00
Michael Schubart
b85deea3f5 Test all types supported by [collection_is_never_read] 2023-04-11 12:27:25 +09:00
bors
3b5b2ed01a Auto merge of #10492 - schubart:collection_is_never_read_unit_type, r=Manishearth
`collection_is_never_read`: Handle unit type

changelog: [`collection_is_never_read`]: Fix false negative
fixes: #10488
2023-04-11 03:05:57 +00:00
Michael Schubart
3d711455c2 Add test case from #10488 2023-04-11 10:37:00 +09:00
Michael Schubart
008ba7326b Ignore fake read access 2023-04-11 10:32:09 +09:00
Michael Schubart
63030acf4f Refactor 2023-04-11 10:27:32 +09:00
bors
5ec2e192f5 Auto merge of #10614 - bluthej:clear-with-drain, r=Manishearth
Clear with drain

Fixes #10572: both the original intent of the issue (extending `clear_with_drain`) and the false negative for `collection_is_never_read` I found in the process are fixed by this PR.

changelog: [`clear_with_drain`]: extend to 5 other types of containers. [`collection_is_never_read`]: fix false negative for `String`s.
2023-04-11 00:29:21 +00:00
bors
e22019d0b7 Auto merge of #10593 - feniljain:fix-needless-return, r=xFrednet
fix(needless_return): do not trigger on ambiguous match arms return

If we see a case where match returns something other than `()`, we just skip `needless_return` lint in that case

Should fix #10546

Relevant Zulip Discussion: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Issue.20.2310546

---

changelog: FP: [`needless_return`]: No longer lints match statements with incompatible branches
[#10593](https://github.com/rust-lang/rust-clippy/pull/10593)
<!-- changelog_checked -->
2023-04-10 21:52:47 +00:00
bors
4904d754e0 Auto merge of #10624 - the8472:remove-drain-filter-feature, r=xFrednet
remove unusued `#![feature(drain_filter)]`

The unstable feature does not appear to be used and its presence blocks work in https://github.com/rust-lang/rust/pull/104455

changelog: none
2023-04-10 12:55:50 +00:00
The 8472
d6fe73db3f remove unusued feature 2023-04-10 13:13:09 +02:00
Deadbeef
4026dde4e5 bump declare_clippy_lint syn to 2.0 2023-04-10 16:53:31 +08:00
bors
015fb8a9e3 Auto merge of #10618 - KisaragiEffective:patch-2, r=llogiq
[missing_const_for_fn] fix #7121

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

changelog: [`missing_const_for_fn`] note about removing const may break compatibility

fix #7121
2023-04-09 18:49:52 +00:00
bors
7de7ca802e Auto merge of #10610 - beetrees:max-line-length, r=Jarcho
Add `max_line_length` to `.editorconfig`, matching `rustfmt.toml`

Add `max_line_length` to `.editorconfig` to match the `max_width` in `rustfmt.toml`.

changelog: none
2023-04-09 18:38:18 +00:00
Kisaragi
ba1f19ee30
apply code review suggestion
Co-authored-by: llogiq <bogusandre@gmail.com>
2023-04-10 01:31:30 +09:00
Kisaragi
5109a8a840
[missing_const_for_fn] fix #7121 2023-04-10 00:55:32 +09:00
bluthej
d8f0a96ba2
Merge branch 'rust-lang:master' into clear-with-drain 2023-04-09 13:40:52 +02:00
bluthej
7852962820 Change format! style to please dogfood test 2023-04-09 13:37:02 +02:00
bluthej
423b54ac12 Update documentation for clear_with_drain
The specific type `Vec` is replaced with the generic term 'container'
2023-04-09 13:29:27 +02:00
bluthej
32aa07f832 Fix false negative for Strings
`String` is not a diagnostic item and was thus not picked up by
`is_type_diagnostic_item`, leading to a false negative for
`collection_is_never_read`
2023-04-09 13:25:50 +02:00
bluthej
5b57e5cec8 Fix false negative with String and add tests
`String` is currently not a diagnostic item so it needs special
treatment
2023-04-09 12:33:20 +02:00
bors
82d71b1b3a Auto merge of #10605 - blyxyas:book-type_checking, r=llogiq
Clippy Book Chapter Updates Reborn: Type Checking

This PR adds a new chapter to the book: "Type Checking", it hasn't changed a lot from the source mainly because there wasn't many reviews on it and I haven't see a lot of things that needed a change.

## Notes

- I have some doubts about the whole "`is_*` Usage" section, what do you think about it.
- For discussion about  the whole project, please use the tracking issue for the project #10597 (It also contains a timeline, discussions, and more information)

changelog: Add a new "Type Checking" chapter to the book

r? `@flip1995`
2023-04-08 22:22:47 +00:00
blyxyas
1cf64060e3
Add "hir::Ty and ty::Ty" section 2023-04-08 17:14:55 +02:00
beetrees
4905a2130a
Add max_line_length to .editorconfig, matching rustfmt.toml 2023-04-08 15:03:34 +01:00
bluthej
9ec542873c Add 5 other container types and start testing 2023-04-07 16:07:43 +02:00
bors
592ea3954d Auto merge of #10604 - blyxyas:fix-book_broken_links, r=flip1995
(Small) Fix broken links for Rust merge

rust-lang/rust#110003's CI is [currently broken](https://github.com/rust-lang/rust/actions/runs/4628510374/jobs/8187672234?pr=110003) because of broken links. This PR fixes that.
It was tested against `lintcheck` and found another broken link in `usage.md` (apart from CI's broken links)

changelog:Fix broken links in the book
Sorry for putting more work on you, but you're the one doing the Rust PR
r? `@flip1995`
2023-04-07 11:51:08 +00:00
bors
4a2cb5a7b8 Auto merge of #10497 - y21:outer_doc_comment_bang, r=dswij
new lint: suspicious_doc_comments

Fixes #10485.

This PR adds a new lint (`suspicious_doc_comments`) that triggers when the user writes `///!` or `/**!`.
This is almost certainly a mistake and the user probably meant to write an inner doc comment (`//!`, `/*!`) to document the module or crate that this comment is contained in.

changelog: [`suspicious_doc_comments`]: new lint
2023-04-07 11:14:10 +00:00
blyxyas
90e6ddc8e7
New chapter: "Type Checking" 2023-04-07 13:11:18 +02:00
y21
5d01e6e96c new lint: suspicious_doc_comments 2023-04-07 12:04:55 +02:00
bors
b8cbce8e6a Auto merge of #10601 - schubart:manual_slice_size_calculation, r=llogiq
Add [`manual_slice_size_calculation`]

Fixes: #10518

---

changelog: new lint [`manual_slice_size_calculation`]
2023-04-07 07:39:11 +00:00
bors
9408d013e3 Auto merge of #10566 - ebobrow:iss10549, r=giraffate
fix `single_component_path_imports` FP on `self::<import>::..`

fixes #10549

I noticed that a couple functions in the file I was working on took `cx` as a parameter but didn't use them, so I removed that. Can revert if desired because it isn't related to my changes.

changelog: [`single_component_path_imports`] don't suggest removing import when it is used as `self::<import>::..`
2023-04-07 00:14:45 +00:00
Michael Schubart
b1c784d31f Fix false negatives by using expr_or_init 2023-04-07 08:00:53 +09:00
blyxyas
cf260bc90f
Fix broken links for Rust merge 2023-04-06 22:02:23 +02:00
bors
de5c6d6b1e Auto merge of #10594 - J-ZhengLi:issue9824, r=Jarcho
fix [`mem_replace_option_with_none`] not considering field variables

fixes: #9824

---

changelog: fix [`mem_replace_option_with_none`] not considering field variables
2023-04-06 14:01:08 +00:00
Michael Schubart
b47a322ef1 Add tests suggested by @llogiq 2023-04-06 13:45:50 +01:00
Michael Schubart
b66aa09b95 Add [manual_slice_size_calculation] 2023-04-06 11:48:20 +01:00
bors
2b05f794e7 Auto merge of #10602 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-04-06 10:34:47 +00:00
Philipp Krones
fa425061e6
Bump nightly version -> 2023-04-06 2023-04-06 12:32:47 +02:00
Philipp Krones
04c387efe7
Merge remote-tracking branch 'upstream/master' into rustup 2023-04-06 12:32:32 +02:00
J-ZhengLi
008e07d4e8 fix [mem_replace_option_with_none] not considering field variables 2023-04-06 16:16:22 +08:00
bors
26e245d2ff Auto merge of #10554 - samueltardieu:redundant-async-block, r=Jarcho
Make redundant_async_block a more complete late pass

This lets us detect more complex situations: `async { x.await }` is simplified into `x` if:

- `x` is an expression without side-effect
- or `x` is an `async` block itself

In both cases, no part of the `async` expression can be part of a macro expansion.

Fixes #10509.
Fixes #10525.

changelog: [`redundant_async_block`] Do not lint expressions with side effects.
2023-04-05 18:31:32 +00:00
feniljain
9cf57d0a8f fix(needles_return): correct span selection for text replacement 2023-04-05 20:03:45 +05:30