Skip to content

Clippy subtree update #119856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 122 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
60c0591
[`default_numeric_fallback`]: don't lint on return and macro calls wi…
J-ZhengLi Dec 13, 2023
eae2317
improve [`cast_sign_loss`], to skip warning on mathmatical expression…
J-ZhengLi Dec 14, 2023
4cea5a8
Do not suggest `[T; n]` instead of `vec![T; n]` if `T` is not `Copy`
samueltardieu Dec 16, 2023
1c431f4
Move check for `PartialEq` in `UNCONDITIONAL_RECURSION` lint into its…
GuillaumeGomez Dec 18, 2023
4ab8cdd
Hide foreign `#[doc(hidden)]` paths in import suggestions
Jules-Bertholet Dec 20, 2023
a9baf34
remove obsolete test comments
J-ZhengLi Dec 25, 2023
a578b9b
make [`mutex_atomic`] more type aware
J-ZhengLi Dec 25, 2023
4c64d7c
ci: Update to `actions/checkout@v4` from `v3`.
waywardmonkeys Dec 26, 2023
c4a80f2
feat: add `manual_is_variant_and` lint
yuxqiu Nov 25, 2023
e5c9fb6
11973: Don't escape `"` in `'"'`
torfsen Dec 27, 2023
affde93
lint on nested binary operations involving local and handle projections
y21 Dec 27, 2023
6c28f07
recognize `contains` calls on ranges
y21 Dec 28, 2023
99b4330
Remove movability from TyKind::Coroutine
compiler-errors Dec 21, 2023
b8aab4b
Polish `missing_enforced_import_renames` documentation
kpreid Dec 28, 2023
15b1edb
Merge commit 'ac4c2094a6030530661bee3876e0228ddfeb6b8b' into clippy-s…
flip1995 Dec 28, 2023
3fceca2
Remove mitigations for incorrect node args
compiler-errors Dec 29, 2023
8b22471
Auto merge of #12041 - compiler-errors:args-are-correct-now, r=Jarcho
bors Dec 29, 2023
fa7dd1c
add new lint, pub_underscore_fields
ParkMyCar Dec 17, 2023
174a0d7
Auto merge of #10283 - ParkMyCar:lint/pub_underscore_fields, r=blyxyas
bors Dec 29, 2023
a4c2cf1
Auto merge of #119387 - flip1995:clippy-subtree-sync, r=matthiaskrgr
bors Dec 29, 2023
1ee9993
add new lint, empty_enum_variants_with_brackets
ARandomDev99 Dec 29, 2023
ca40b0c
fix/issue#11243: allow 3-digit-grouped binary in non_octal_unix_permi…
cocodery Dec 29, 2023
95f8f1e
fix typo in creating early lint pass
mikkoglinn678 Dec 30, 2023
0848e12
add expansion checks to `iter_without_into_iter` and `into_iter_witho…
y21 Dec 30, 2023
c2b3f5c
`identity_op` correctly suggests a deference for coerced references
PartiallyUntyped Dec 30, 2023
79e70cc
add setuid, setgid and sticky bits on high 3-bits of 12
cocodery Dec 30, 2023
ab2d1c2
Extend `UNCONDITIONAL_RECURSION` to check for `ToString` implementations
GuillaumeGomez Dec 18, 2023
d161f3b
Add ui test for `UNCONDITIONAL_RECURSION` lint on `ToString` impl
GuillaumeGomez Dec 18, 2023
c992247
Auto merge of #12054 - y21:issue12037, r=Jarcho
bors Dec 30, 2023
b19b5f2
Auto merge of #12008 - J-ZhengLi:issue9872, r=Jarcho
bors Dec 30, 2023
c6aeb28
Auto merge of #11865 - yuxqiu:map_unwrap_or_default, r=Jarcho
bors Dec 30, 2023
0cc53f4
Auto merge of #11957 - J-ZhengLi:issue11535, r=Jarcho
bors Dec 30, 2023
5f17188
Change `empty_enum_variants_with_brackets` applicability to `MaybeInc…
ARandomDev99 Dec 30, 2023
7f185bd
Auto merge of #12047 - ARandomDev99:12007-empty-enum-variants-with-br…
bors Dec 30, 2023
44c99a8
Auto merge of #11980 - GuillaumeGomez:UNCONDITIONAL_RECURSION-tostrin…
bors Dec 31, 2023
eca3932
Auto merge of #12053 - mikkoglinn678:fix_new_lint_typo, r=llogiq
bors Dec 31, 2023
d3bde85
Fix false positive in `PartialEq` implementation
GuillaumeGomez Dec 30, 2023
7107aa2
Add regression tests for `unconditional_recursion`
GuillaumeGomez Dec 31, 2023
fe35e08
8733: Suggest `str.lines` when splitting at hard-coded newlines
torfsen Dec 17, 2023
457ab58
Add `.front()` to `get_first` lint description
samueltardieu Dec 31, 2023
a89eb85
Auto merge of #11987 - torfsen:8733-Suggest-str.lines-when-splitting-…
bors Dec 31, 2023
e1dbafd
Auto merge of #12065 - samueltardieu:issue-12063, r=llogiq
bors Dec 31, 2023
ef35e82
don't look for safety comments in codeblocks
y21 Jan 1, 2024
70024e1
New Lint: [`thread_local_initializer_can_be_made_const`]
PartiallyUntyped Dec 27, 2023
ff2919a
Remove deadlinks from `unchecked_duration_subtraction`
ShE3py Jan 1, 2024
de06ce8
Address unused tuple struct fields in clippy
shepmaster Nov 29, 2023
e73bb00
Auto merge of #12026 - PartiallyTyped:12015, r=llogiq
bors Jan 2, 2024
04ebf3c
Remove #[allow(unused_tuple_struct_fields)] from Clippy tests
shepmaster Nov 29, 2023
88541d6
fix some typos
yuxqiu Jan 3, 2024
9eb2b22
Auto merge of #12079 - yuxqiu:fix_typos, r=Manishearth
bors Jan 3, 2024
2eb13d3
Auto merge of #12056 - PartiallyTyped:12050, r=xFrednet
bors Jan 3, 2024
0153ca9
Auto merge of #12062 - GuillaumeGomez:fix-false-positive-unconditiona…
bors Jan 3, 2024
18e4632
Update copyright year for Clippy (2024 edition)
blyxyas Jan 3, 2024
5960107
new lint: `option_as_ref_cloned`
y21 Dec 30, 2023
ca83a98
Track `HirId` instead of `Span` in `ObligationCauseCode::SizedArgumen…
estebank Dec 20, 2023
bc962c2
Auto merge of #12071 - ShE3py:deadlinks, r=blyxyas
bors Jan 3, 2024
17dcd0d
Auto merge of #12030 - torfsen:11973-fix-quoting-of-double-quote-in-c…
bors Jan 3, 2024
ebf5c1a
Auto merge of #12031 - y21:eager_transmute_more_binops, r=llogiq
bors Jan 3, 2024
ee04871
Auto merge of #12086 - blyxyas:update-copyright, r=flip1995
bors Jan 4, 2024
691d4e2
Auto merge of #12023 - waywardmonkeys:ci-update-checkout-action, r=fl…
bors Jan 4, 2024
89e4b71
Include GitLab in the CI section of the clippy doc book
jetlime Dec 27, 2023
0bf0b88
Auto merge of #12025 - jetlime:master, r=flip1995
bors Jan 4, 2024
9dcf926
fix: metadata-collector listing lints when config documents include c…
granddaifuku Jan 4, 2024
52ae262
Auto merge of #12088 - granddaifuku:fix/metadata-collector-lint-listi…
bors Jan 4, 2024
e758413
Add .as_ref() to suggestion to remove .to_string()
samueltardieu Jan 4, 2024
2666f39
Detect unconditional recursion between Default trait impl and static …
GuillaumeGomez Jan 3, 2024
bf5c0d8
Add tests for extension of `unconditional_recursion` lint on `Default…
GuillaumeGomez Jan 4, 2024
8507e4c
Auto merge of #12090 - GuillaumeGomez:default-unconditional-recursion…
bors Jan 4, 2024
0bac101
Rename `EmitterWriter` as `HumanEmitter`.
nnethercote Jan 4, 2024
ee8bfb7
Auto merge of #12051 - y21:option_as_ref_cloned, r=dswij
bors Jan 5, 2024
890c070
don't change eagerness for struct literal syntax with significant drop
y21 Jan 5, 2024
f73e37d
Update clippy for hir::Guard removal
matthewjasper Jan 4, 2024
2d6c238
Auto merge of #12091 - samueltardieu:issue-12068, r=Alexendoo
bors Jan 5, 2024
d3dfecb
Auto merge of #12066 - y21:issue12048, r=Alexendoo
bors Jan 5, 2024
eec0f3d
Auto merge of #12036 - kpreid:patch-1, r=Alexendoo
bors Jan 5, 2024
9e4e8ef
Don't emit `struct_field_names` lint if all fields are booleans and d…
GuillaumeGomez Jan 5, 2024
7aa4624
Extend `struct_field_names` lint ui test
GuillaumeGomez Jan 5, 2024
2dba787
Update URLs in `Type Checking`
jubnzv Jan 5, 2024
3a683f6
Rollup merge of #119148 - estebank:bare-traits, r=davidtwco
compiler-errors Jan 5, 2024
d201225
Rollup merge of #119601 - nnethercote:Emitter-cleanups, r=oli-obk
compiler-errors Jan 5, 2024
9ee4d9e
Auto merge of #12100 - jubnzv:update-urls, r=flip1995
bors Jan 5, 2024
fd9d330
Don't lint `let_unit_value` when `()` is explicit
Centri3 May 30, 2023
394f63f
Auto merge of #10844 - Centri3:let_unit_value, r=Alexendoo
bors Jan 5, 2024
7bb0e9c
Auto merge of #12099 - GuillaumeGomez:struct-field-names-bool, r=llogiq
bors Jan 5, 2024
b418117
Rollup merge of #119151 - Jules-Bertholet:no-foreign-doc-hidden-sugge…
matthiaskrgr Jan 5, 2024
84c4b52
Rollup merge of #119554 - matthewjasper:remove-guard-distinction, r=c…
matthiaskrgr Jan 5, 2024
5d57ba8
Auto merge of #12097 - y21:issue9427-3, r=llogiq
bors Jan 5, 2024
e10a05d
rustc_span: Optimize syntax context comparisons
petrochenkov Jan 2, 2024
60c647b
Fix bug: allow no- '_'-split binary format string, add test
cocodery Jan 6, 2024
d1b8d9c
Auto merge of #119531 - petrochenkov:cmpctxt, r=cjgillot
bors Jan 6, 2024
28c133b
Extend `map_clone` lint to also work on non-explicit closures
GuillaumeGomez Jan 6, 2024
6410606
Update `map_clone` lint ui test
GuillaumeGomez Jan 6, 2024
af35d37
Fix new dogfood issue
GuillaumeGomez Jan 6, 2024
17b2418
Auto merge of #12104 - GuillaumeGomez:map-clone, r=llogiq
bors Jan 6, 2024
788094c
Auto merge of #11972 - samueltardieu:issue-11958, r=llogiq
bors Jan 6, 2024
0e5dc8e
Auto merge of #11883 - J-ZhengLi:issue11642, r=dswij
bors Jan 6, 2024
5b7a0de
Do not suggest `bool::then()` and `bool::then_some` in `const` contexts
samueltardieu Jan 7, 2024
78aa2e2
Handle "calls" inside the closure as well in `map_clone` lint
GuillaumeGomez Jan 7, 2024
f66e940
Update ui test for `map_clone` lint
GuillaumeGomez Jan 7, 2024
adc5bc9
Auto merge of #12108 - samueltardieu:issue-12103, r=xFrednet
bors Jan 7, 2024
f37e7f3
Auto merge of #12109 - GuillaumeGomez:map-clone-call, r=llogiq
bors Jan 7, 2024
a843996
Simplify check function, weirdly binary format literals happen not often
cocodery Jan 7, 2024
bbadce9
Fixed ICE introduced in #12004
PartiallyUntyped Jan 3, 2024
7fbaba8
Auto merge of #12080 - PartiallyTyped:12058, r=xFrednet
bors Jan 7, 2024
122520d
Make `DiagnosticBuilder::emit` consuming.
nnethercote Jan 3, 2024
3b8323d
Auto merge of #12049 - cocodery:fix/issue#11243, r=Alexendoo
bors Jan 8, 2024
89f511e
Rustdoc and Clippy stop misusing Key for Ty -> (adt) DefId
compiler-errors Nov 12, 2023
4ab6924
Extend `useless_asref` lint on `map(clone)`
GuillaumeGomez Jan 6, 2024
cdd96bc
Update ui tests for `useless_asref` lint extension
GuillaumeGomez Jan 6, 2024
8791a28
Also handle `Result` type for `map_clone` lint
GuillaumeGomez Jan 9, 2024
e90eea7
Clean up code in `map_clone` and `useless_asref` lints
GuillaumeGomez Jan 9, 2024
83ae5ed
Don't lint with `map_clone` if current type is `Option` or `Result` a…
GuillaumeGomez Jan 9, 2024
103e888
Add tests to ensure that `map_clone` is not emitted if `as_ref().clon…
GuillaumeGomez Jan 9, 2024
f7ef9a6
Fix dogfood and add code comments
GuillaumeGomez Jan 9, 2024
beeaee9
Rename consuming chaining methods on `DiagnosticBuilder`.
nnethercote Jan 8, 2024
e899684
Auto merge of #12105 - GuillaumeGomez:useless-asf-extension, r=llogiq
bors Jan 10, 2024
31a27ed
Remove giraffate from the reviewer rotation
giraffate Jan 11, 2024
87ff58d
Auto merge of #12127 - giraffate:remove_giraffate_from_the_reviewer_r…
bors Jan 11, 2024
2c0cea7
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Jan 11, 2024
7d8b6e4
Bump nightly version -> 2024-01-11
flip1995 Jan 11, 2024
26ac6aa
Auto merge of #12130 - flip1995:rustup, r=flip1995
bors Jan 11, 2024
af39354
Merge commit '26ac6aab023393c94edf42f38f6ad31196009643'
flip1995 Jan 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tools/clippy/.github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
github_token: "${{ secrets.github_token }}"

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install toolchain
run: rustup show active-toolchain
Expand Down
10 changes: 5 additions & 5 deletions src/tools/clippy/.github/workflows/clippy_bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
github_token: "${{ secrets.github_token }}"

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
github_token: "${{ secrets.github_token }}"

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install i686 dependencies
if: matrix.host == 'i686-unknown-linux-gnu'
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
github_token: "${{ secrets.github_token }}"

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install toolchain
run: rustup show active-toolchain
Expand All @@ -175,7 +175,7 @@ jobs:
github_token: "${{ secrets.github_token }}"

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install toolchain
run: rustup show active-toolchain
Expand Down Expand Up @@ -231,7 +231,7 @@ jobs:
github_token: "${{ secrets.github_token }}"

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install toolchain
run: rustup show active-toolchain
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/.github/workflows/clippy_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
steps:
# Setup
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

# Run
- name: Build
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/.github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
steps:
# Setup
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ env.TARGET_BRANCH }}
path: 'out'
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/.github/workflows/remark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
# Setup
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
Expand Down
7 changes: 7 additions & 0 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5105,6 +5105,7 @@ Released 2018-09-13
[`else_if_without_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#else_if_without_else
[`empty_drop`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_drop
[`empty_enum`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_enum
[`empty_enum_variants_with_brackets`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_enum_variants_with_brackets
[`empty_line_after_doc_comments`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments
[`empty_line_after_outer_attr`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_outer_attr
[`empty_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_loop
Expand Down Expand Up @@ -5294,6 +5295,7 @@ Released 2018-09-13
[`manual_is_ascii_check`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_ascii_check
[`manual_is_finite`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_finite
[`manual_is_infinite`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_infinite
[`manual_is_variant_and`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_variant_and
[`manual_let_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
[`manual_main_separator_str`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_main_separator_str
[`manual_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
Expand Down Expand Up @@ -5440,6 +5442,7 @@ Released 2018-09-13
[`only_used_in_recursion`]: https://rust-lang.github.io/rust-clippy/master/index.html#only_used_in_recursion
[`op_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
[`option_and_then_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_and_then_some
[`option_as_ref_cloned`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_as_ref_cloned
[`option_as_ref_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_as_ref_deref
[`option_env_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_env_unwrap
[`option_expect_used`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_expect_used
Expand Down Expand Up @@ -5483,6 +5486,7 @@ Released 2018-09-13
[`ptr_eq`]: https://rust-lang.github.io/rust-clippy/master/index.html#ptr_eq
[`ptr_offset_with_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#ptr_offset_with_cast
[`pub_enum_variant_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#pub_enum_variant_names
[`pub_underscore_fields`]: https://rust-lang.github.io/rust-clippy/master/index.html#pub_underscore_fields
[`pub_use`]: https://rust-lang.github.io/rust-clippy/master/index.html#pub_use
[`pub_with_shorthand`]: https://rust-lang.github.io/rust-clippy/master/index.html#pub_with_shorthand
[`pub_without_shorthand`]: https://rust-lang.github.io/rust-clippy/master/index.html#pub_without_shorthand
Expand Down Expand Up @@ -5580,6 +5584,7 @@ Released 2018-09-13
[`stable_sort_primitive`]: https://rust-lang.github.io/rust-clippy/master/index.html#stable_sort_primitive
[`std_instead_of_alloc`]: https://rust-lang.github.io/rust-clippy/master/index.html#std_instead_of_alloc
[`std_instead_of_core`]: https://rust-lang.github.io/rust-clippy/master/index.html#std_instead_of_core
[`str_split_at_newline`]: https://rust-lang.github.io/rust-clippy/master/index.html#str_split_at_newline
[`str_to_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string
[`string_add`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_add
[`string_add_assign`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_add_assign
Expand Down Expand Up @@ -5612,6 +5617,7 @@ Released 2018-09-13
[`temporary_cstring_as_ptr`]: https://rust-lang.github.io/rust-clippy/master/index.html#temporary_cstring_as_ptr
[`test_attr_in_doctest`]: https://rust-lang.github.io/rust-clippy/master/index.html#test_attr_in_doctest
[`tests_outside_test_module`]: https://rust-lang.github.io/rust-clippy/master/index.html#tests_outside_test_module
[`thread_local_initializer_can_be_made_const`]: https://rust-lang.github.io/rust-clippy/master/index.html#thread_local_initializer_can_be_made_const
[`to_digit_is_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_digit_is_some
[`to_string_in_display`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_display
[`to_string_in_format_args`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args
Expand Down Expand Up @@ -5810,4 +5816,5 @@ Released 2018-09-13
[`allowed-dotfiles`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allowed-dotfiles
[`enforce-iter-loop-reborrow`]: https://doc.rust-lang.org/clippy/lint_configuration.html#enforce-iter-loop-reborrow
[`check-private-items`]: https://doc.rust-lang.org/clippy/lint_configuration.html#check-private-items
[`pub-underscore-fields-behavior`]: https://doc.rust-lang.org/clippy/lint_configuration.html#pub-underscore-fields-behavior
<!-- end autogenerated links to configuration documentation -->
2 changes: 1 addition & 1 deletion src/tools/clippy/COPYRIGHT
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// REUSE-IgnoreStart

Copyright 2014-2022 The Rust Project Developers
Copyright 2014-2024 The Rust Project Developers

Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/LICENSE-APACHE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2014-2022 The Rust Project Developers
Copyright 2014-2024 The Rust Project Developers

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2014-2022 The Rust Project Developers
Copyright (c) 2014-2024 The Rust Project Developers

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.

[There are over 650 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
[There are over 700 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)

Lints are divided into categories, each with a default [lint level](https://doc.rust-lang.org/rustc/lints/levels.html).
You can choose how much Clippy is supposed to ~~annoy~~ help you by changing the lint level by category.
Expand Down Expand Up @@ -278,7 +278,7 @@ If you want to contribute to Clippy, you can find more information in [CONTRIBUT

<!-- REUSE-IgnoreStart -->

Copyright 2014-2023 The Rust Project Developers
Copyright 2014-2024 The Rust Project Developers

Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
[https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)> or the MIT license
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/book/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
A collection of lints to catch common mistakes and improve your
[Rust](https://github.com/rust-lang/rust) code.

[There are over 650 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
[There are over 700 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)

Lints are divided into categories, each with a default [lint
level](https://doc.rust-lang.org/rustc/lints/levels.html). You can choose how
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [Clippy's Lints](lints.md)
- [Continuous Integration](continuous_integration/README.md)
- [GitHub Actions](continuous_integration/github_actions.md)
- [GitLab CI](continuous_integration/gitlab.md)
- [Travis CI](continuous_integration/travis.md)
- [Development](development/README.md)
- [Basics](development/basics.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run Clippy
run: cargo clippy --all-targets --all-features
```
16 changes: 16 additions & 0 deletions src/tools/clippy/book/src/continuous_integration/gitlab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# GitLab CI

You can add Clippy to GitLab CI by using the latest stable [rust docker image](https://hub.docker.com/_/rust),
as it is shown in the `.gitlab-ci.yml` CI configuration file below,

```yml
# Make sure CI fails on all warnings, including Clippy lints
variables:
RUSTFLAGS: "-Dwarnings"

clippy_check:
image: rust:latest
script:
- rustup component add clippy
- cargo clippy --all-targets --all-features
```
2 changes: 1 addition & 1 deletion src/tools/clippy/book/src/development/macro_expansions.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ let x: Option<u32> = Some(42);
m!(x, x.unwrap());
```

If the `m!(x, x.unwrapp());` line is expanded, we would get two expanded
If the `m!(x, x.unwrap());` line is expanded, we would get two expanded
expressions:

- `x.is_some()` (from the `$a.is_some()` line in the `m` macro)
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/book/src/development/type_checking.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ in this chapter:
- [Type checking](https://rustc-dev-guide.rust-lang.org/type-checking.html)
- [Ty module](https://rustc-dev-guide.rust-lang.org/ty.html)

[Adt]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_type_ir/sty/enum.TyKind.html#variant.Adt
[Adt]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_type_ir/ty_kind/enum.TyKind.html#variant.Adt
[AdtDef]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/adt/struct.AdtDef.html
[expr_ty]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TypeckResults.html#method.expr_ty
[node_type]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TypeckResults.html#method.node_type
Expand All @@ -144,7 +144,7 @@ in this chapter:
[LateLintPass]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint/trait.LateLintPass.html
[pat_ty]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/typeck_results/struct.TypeckResults.html#method.pat_ty
[Ty]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.Ty.html
[TyKind]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_type_ir/sty/enum.TyKind.html
[TyKind]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_type_ir/ty_kind/enum.TyKind.html
[TypeckResults]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TypeckResults.html
[middle_ty]: https://doc.rust-lang.org/beta/nightly-rustc/rustc_middle/ty/struct.Ty.html
[hir_ty]: https://doc.rust-lang.org/beta/nightly-rustc/rustc_hir/struct.Ty.html
Expand Down
10 changes: 10 additions & 0 deletions src/tools/clippy/book/src/lint_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -805,3 +805,13 @@ for _ in &mut *rmvec {}
* [`missing_errors_doc`](https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc)


## `pub-underscore-fields-behavior`


**Default Value:** `"PublicallyExported"`

---
**Affected lints:**
* [`pub_underscore_fields`](https://rust-lang.github.io/rust-clippy/master/index.html#pub_underscore_fields)


7 changes: 6 additions & 1 deletion src/tools/clippy/clippy_config/src/conf.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::msrvs::Msrv;
use crate::types::{DisallowedPath, MacroMatcher, MatchLintBehaviour, Rename};
use crate::types::{DisallowedPath, MacroMatcher, MatchLintBehaviour, PubUnderscoreFieldsBehaviour, Rename};
use crate::ClippyConfiguration;
use rustc_data_structures::fx::FxHashSet;
use rustc_session::Session;
Expand Down Expand Up @@ -547,6 +547,11 @@ define_Conf! {
///
/// Whether to also run the listed lints on private items.
(check_private_items: bool = false),
/// Lint: PUB_UNDERSCORE_FIELDS
///
/// Lint "public" fields in a struct that are prefixed with an underscore based on their
/// exported visibility, or whether they are marked as "pub".
(pub_underscore_fields_behavior: PubUnderscoreFieldsBehaviour = PubUnderscoreFieldsBehaviour::PublicallyExported),
}

/// Search for the configuration file.
Expand Down
3 changes: 3 additions & 0 deletions src/tools/clippy/clippy_config/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ fn parse_config_field_doc(doc_comment: &str) -> Option<(Vec<String>, String)> {
doc_comment.make_ascii_lowercase();
let lints: Vec<String> = doc_comment
.split_off(DOC_START.len())
.lines()
.next()
.unwrap()
.split(", ")
.map(str::to_string)
.collect();
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_config/src/msrvs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ macro_rules! msrv_aliases {
// names may refer to stabilized feature flags or library items
msrv_aliases! {
1,71,0 { TUPLE_ARRAY_CONVERSIONS, BUILD_HASHER_HASH_ONE }
1,70,0 { OPTION_IS_SOME_AND, BINARY_HEAP_RETAIN }
1,70,0 { OPTION_RESULT_IS_VARIANT_AND, BINARY_HEAP_RETAIN }
1,68,0 { PATH_MAIN_SEPARATOR_STR }
1,65,0 { LET_ELSE, POINTER_CAST_CONSTNESS }
1,62,0 { BOOL_THEN_SOME, DEFAULT_ENUM_ATTRIBUTE }
Expand Down
6 changes: 6 additions & 0 deletions src/tools/clippy/clippy_config/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,9 @@ unimplemented_serialize! {
Rename,
MacroMatcher,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize)]
pub enum PubUnderscoreFieldsBehaviour {
PublicallyExported,
AllPubFields,
}
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_dev/src/new_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub fn create(
if pass == "early" {
println!(
"\n\
NOTE: Use a late pass unless you need something specific from\
NOTE: Use a late pass unless you need something specific from\n\
an early pass, as they lack many features and utilities"
);
}
Expand Down
Loading