Commit Graph

16687 Commits

Author SHA1 Message Date
Nilstrieb
8f53926232 Alloc hir::Lit in an arena to remove the destructor from Expr
This allows allocating `Expr`s into a dropless arena, which is useful
for using length prefixed thing slices in HIR, since these can only be
allocated in the dropless arena and not in a typed arena. This is
something I'm working on.
2023-04-16 15:35:51 +00:00
Caio
d6390625dc Address comments 2023-04-15 16:05:46 -03:00
bors
004981647f Auto merge of #10622 - blyxyas:book-lint_passes, r=llogiq
Clippy Book Chapter Updates Reborn: Lint Passes

This PR adds a new chapter to the book: "Lint passes". No major changes apart from some re-phrasing, fixing typos... etc.

## Notes

- Requires #10595 to be merged before this one (Or else, a link will be broken).
- To talk 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 "Lint passes" chapter to the book
r? `@flip1995`
2023-04-14 17:04:54 +00:00
bors
d61570ceb6 Auto merge of #110160 - petrochenkov:notagain2, r=cjgillot
resolve: Pre-compute non-reexport module children

Instead of repeating the same logic by walking HIR during metadata encoding.

The only difference is that we are no longer encoding `macro_rules` items, but we never currently need them as a part of this list. They can be encoded separately if this need ever arises.

`module_reexports` is also un-querified, because I don't see any reasons to make it a query, only overhead.
2023-04-14 01:14:36 +00:00
Manish Goregaokar
b2edd42b24
Merge pull request #10603 from robertbastian/octal
Fix false positives and false negatives in `octal_escapes`
2023-04-13 15:50:00 -07:00
Esteban Küber
4680aa2fd0 Special-case item attributes in the suggestion output 2023-04-12 22:50:10 +00:00
Esteban Küber
7a0fb902bc Tweak output for 'add line' suggestion 2023-04-12 22:50:10 +00:00
blyxyas
b4732679fc
Talk about symbol information in "Early Lint Pass" 2023-04-12 23:59:56 +02:00
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
Vadim Petrochenkov
5989400e2e resolve: Pre-compute non-reexport module children
Instead of repeating the same logic by walking HIR during metadata encoding.

The only difference is that we are no longer encoding `macro_rules` items, but we never currently need them as a part of this list.
They can be encoded separately if this need ever arises.

`module_reexports` is also un-querified, because I don't see any reasons to make it a query, only overhead.
2023-04-12 15:22:03 +03: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
Philipp Krones
6b95029f17 Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup 2023-04-11 15:31:08 +02: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
Ben Kimock
fe129a022a Merge from rustc 2023-04-10 07:55:57 -04:00
The 8472
d6fe73db3f remove unusued feature 2023-04-10 13:13:09 +02:00
blyxyas
c19c08f4b2
Fix CI 2023-04-10 11:09:52 +02:00
blyxyas
0b1b535116
Add "Lint Passes" chapter 2023-04-10 10:59:12 +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
Caio
cd0009eb30 Suppress the triggering of some lints in derived structures 2023-04-09 08:16:20 -03: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
d048c1130f Auto merge of #110031 - compiler-errors:generic-elaboration, r=b-naber
Make elaboration generic over input

Combines all the `elaborate_*` family of functions into just one, which is an iterator over the same type that you pass in (e.g. elaborating `Predicate` gives `Predicate`s, elaborating `Obligation`s gives `Obligation`s, etc.)
2023-04-09 00:18:10 +00: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