Skip to content
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

Clippy subtree update #127609

Merged
merged 160 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
0eb9f41
make it more readable by faster early exitting
tesuji May 24, 2024
aff0e6d
add uitest for indexing in unnecessary const items
tesuji May 24, 2024
b161dc6
add utils is_inside_always_const_context
tesuji May 24, 2024
2c61b45
do not lint on indexing inside const contexts
tesuji May 24, 2024
e18b27a
add uitest for issue 12816
tesuji May 24, 2024
ac60028
ignore `assertions-on-constants` in const contexts
tesuji May 24, 2024
a0234b4
Ignore non ExprKind::{Path,Lit) inside const context
tesuji Jun 8, 2024
ed9ccf6
[`unnecessary_to_owned`]: catch to_owned from byte slice to string
y21 Jun 19, 2024
dcb6a54
fix wrong msrv import in `new_lint` template
J-ZhengLi Jun 21, 2024
625091d
Fix doc nits
bitfield Jun 23, 2024
cfccdbb
Clarify that `modulo_one` only applies to ints
Rudxain Jun 20, 2024
b60a6ad
Make queries more explicit
compiler-errors Jun 27, 2024
abdd057
Merge commit '68a799aea9b65e2444fbecfe32217ce7d5a3604f' into clippy-s…
flip1995 Jun 27, 2024
39a2155
Tighten spans for async blocks
compiler-errors Jun 27, 2024
6de8782
doc_lazy_continuation: blank comment line for gap
notriddle Jun 27, 2024
fb95df7
Rollup merge of #127058 - compiler-errors:tighten-async-spans, r=oli-obk
matthiaskrgr Jun 28, 2024
01a6dfa
Add error message to manual_inspect lint
flip1995 Jun 28, 2024
74bc964
finishing touches, move fixed ICEs to ui tests
fee1-dead Jun 25, 2024
2fcef6e
address review comments
fee1-dead Jun 26, 2024
2f80536
Auto merge of #13002 - notriddle:notriddle/blank-line, r=Manishearth
bors Jun 28, 2024
1aa236d
Auto merge of #13006 - flip1995:manual-inspect-error-message, r=Jarcho
bors Jun 28, 2024
4116552
Rollup merge of #127045 - compiler-errors:explicit, r=oli-obk
matthiaskrgr Jun 29, 2024
eb33c1a
Image-related valid idents
kornelski Jun 28, 2024
b5f9436
Auto merge of #120639 - fee1-dead-contrib:new-effects-desugaring, r=o…
bors Jun 29, 2024
b08b8b8
Implement a lint to replace bit manual rotations with rotate_left/rot…
frp Jun 23, 2024
06758d8
Auto merge of #12970 - J-ZhengLi:new_lint_msrv, r=y21
bors Jul 1, 2024
eb1b24a
`manual_inspect`: fix `clippy::version` from 1.78.0 to 1.81.0
ojeda Jun 30, 2024
0abcd34
Auto merge of #12983 - frp:manual_rotate, r=llogiq
bors Jul 1, 2024
f24a870
Auto merge of #13025 - ojeda:manual_inspect_nightly, r=y21
bors Jul 1, 2024
0dddf6e
Fix doc for verbose_bit_mask
alex-semenyuk Jul 1, 2024
5cbf6d5
clippy: update to pulldown-cmark 0.11
notriddle Jun 29, 2024
d255efc
Auto merge of #13026 - alex-semenyuk:fix_doc_verbose_bit_mask_example…
bors Jul 1, 2024
76a068b
Skip installing rust-docs with minimal rustup profile
tesuji Jul 1, 2024
0505dad
Auto merge of #13017 - kornelski:idents, r=blyxyas
bors Jul 1, 2024
c412528
Auto merge of #12840 - tesuji:const-asserts, r=llogiq
bors Jul 1, 2024
567bea2
Fix `into_iter_without_iter` false positive when the implementation i…
astra90x Jul 2, 2024
ba05b76
Add regression test for #12964
astra90x Jul 2, 2024
0dd8b27
Fix formatting
astra90x Jul 2, 2024
f715bfc
chore: remove duplicate words
hattizai Jul 2, 2024
c4f81d0
Auto merge of #13029 - tesuji:minimal, r=flip1995
bors Jul 2, 2024
6e6683b
Auto merge of #13030 - astra-90:master, r=Alexendoo
bors Jul 2, 2024
2da0edb
Honor avoid-breaking-exported-api in needless_pass_by_ref_mut
flip1995 Oct 9, 2023
125c778
Move exported check to check_fn to exit early
flip1995 Jul 2, 2024
70c8579
doc_markdown: detect escaped `` ` `` when checking unmatched
notriddle Jun 28, 2024
cd60231
Instance::resolve -> Instance::try_resolve, and other nits
compiler-errors Jul 2, 2024
3af2005
Auto merge of #13010 - notriddle:notriddle/unbalanced-ticks-backslash…
bors Jul 2, 2024
ae47b97
needless-pass-by-ref-mut: Update conf documentation
flip1995 Jul 3, 2024
918ae1b
Auto merge of #11647 - flip1995:needless-pass-by-ref-mut-pub-api, r=x…
bors Jul 3, 2024
b52ac9a
Auto merge of #125507 - compiler-errors:type-length-limit, r=lcnr
bors Jul 3, 2024
7b76b94
add test 12969 and 9841
tesuji Jun 21, 2024
388de38
Make it easier to print debugging with Debug
tesuji Jun 21, 2024
c4c41d1
Fix 12969 and fix 9841
tesuji Jul 3, 2024
0f4035f
Auto merge of #12976 - tesuji:fix-explicit_auto_deref, r=xFrednet
bors Jul 3, 2024
0f915f6
Add new lint `hashset_insert_after_contains`
lochetti May 31, 2024
6661e83
Rename lint, generalize function, add known issues, use multispan
lochetti Jun 3, 2024
eff6f68
Fix typos
lochetti Jul 3, 2024
4e71fc4
Small fix after rebase
lochetti Jul 3, 2024
903874d
`needless_return`: Support `#[expect]` on the return statement
xFrednet Jul 1, 2024
a4bdab3
Auto merge of #13027 - xFrednet:12998-expect-returns, r=Jarcho
bors Jul 3, 2024
2440075
Auto merge of #127127 - notriddle:notriddle/pulldown-cmark-0.11, r=Gu…
bors Jul 4, 2024
9b7227c
Properly handle removal suggestion rendering
estebank Jul 3, 2024
378962f
Lint significant drop on `while let` and `if let`
lrh2000 Apr 29, 2024
d2400a4
Auto merge of #12873 - lochetti:issue_11103, r=llogiq
bors Jul 4, 2024
3a71223
[`missing_const_for_fn`]: fix suggestions for fn with abi that requir…
J-ZhengLi Jul 4, 2024
88c4a22
New Lint: `byte_char_slices`
TheNeikos Jan 4, 2023
2b01d69
Auto merge of #10155 - TheNeikos:feature/add_byte_char_slice_lint, r=…
bors Jul 4, 2024
4d26177
Rollup merge of #127301 - estebank:fix-suggestions, r=Urgau
matthiaskrgr Jul 4, 2024
5b30f6a
`almost_complete_range`: Delay suggestion creation.
Jarcho Jun 8, 2024
0aac16e
Auto merge of #13037 - J-ZhengLi:issue13008, r=llogiq
bors Jul 5, 2024
d9ab0a7
Refactor `assigning_clones`:
Jarcho Jun 9, 2024
9d8a177
Refactor `bool_to_int_with_if`:
Jarcho Jun 9, 2024
885f97e
Auto merge of #11656 - y21:unnecessary_string_from_utf8, r=Jarcho
bors Jul 5, 2024
ac939ad
Refactor `disallowed_script_idents`: Simplify script checking loop.
Jarcho Jun 10, 2024
4c44b4e
Remove `is_test_module_or_function` and use `is_in_test` instead.
Jarcho Jun 10, 2024
60af258
Refactor `disallowed_methods`:
Jarcho Jun 9, 2024
6d61bda
Use `is_in_test` in more places.
Jarcho Jul 5, 2024
e7f2952
Auto merge of #13047 - Jarcho:script, r=y21
bors Jul 5, 2024
2c09ac3
feat: add cfg_not_test lint
mrnossiom Jun 12, 2024
dd37441
test: add cfg_not_test tests
mrnossiom Jun 12, 2024
3ef3667
Auto merge of #13049 - Jarcho:is_in_test, r=Alexendoo
bors Jul 5, 2024
94a000b
Auto merge of #11293 - mrnossiom:11234, r=Jarcho
bors Jul 5, 2024
6621e6c
Rename thread_local_initializer_can_be_made_const to missing_const_fo…
alex-semenyuk Jun 21, 2024
25bb612
Lintcheck: Add `--warn-all` and make it the CI default
xFrednet Jul 5, 2024
3ed690f
Auto merge of #12974 - alex-semenyuk:rename_thread_local_initializer_…
bors Jul 5, 2024
ecbb2d7
remove internal `compiler_lint_functions` lint
y21 Jul 5, 2024
d8fb164
Rename `any_parent_is_automatically_derived` to `in_automatically_der…
Jarcho Jun 9, 2024
0c9016a
Auto merge of #13055 - Jarcho:auto_derive, r=Alexendoo
bors Jul 6, 2024
e0f32e0
Mark format! with must_use hint
Jul 4, 2024
7ce4a49
iter_identity is a better name
compiler-errors Jul 6, 2024
f7050b0
resolve code review comments
bitfield Jul 7, 2024
5a9e5e4
resolve code review comments
bitfield Jul 7, 2024
f2c74e2
Auto merge of #12966 - Rudxain:patch-1, r=dswij
bors Jul 7, 2024
aa371c3
Rewrite `overflow_check_conditional`
Jarcho Jun 16, 2024
23d96f6
Rename `overflow_check_conditional` to `panicking_overflow_checks`.
Jarcho Jun 17, 2024
d2ff2b9
Move `panicking_overflow_checks` into `correctness` and clean up docs.
Jarcho Jun 17, 2024
09c07ed
Auto merge of #13048 - Jarcho:disallowed_methods, r=blyxyas
bors Jul 7, 2024
791ff40
Add support for `mir::TerminatorKind::TailCall` in clippy
WaffleLapkin May 9, 2023
93e74a4
Lintcheck: Update lintcheck documentation
xFrednet Jul 7, 2024
a413281
Auto merge of #13052 - xFrednet:00000-lintcheck-warn-all, r=Alexendoo
bors Jul 7, 2024
8e2ddc8
`inherent_to_string`: Check HIR tree before checking for macros.
Jarcho Jun 12, 2024
dc8403f
`inline_fn_without_body`: inline into a single function
Jarcho Jun 12, 2024
aef0710
`instant_subtraction`: Reduce redundant work.
Jarcho Jun 12, 2024
ca5c281
`items_after_statements`: Do less work in the default case.
Jarcho Jun 13, 2024
fa1a690
`iter_not_returning_iterator`:
Jarcho Jun 13, 2024
6b10b43
`iter_without_into_iter`: Delay macro check
Jarcho Jun 13, 2024
3092c8a
`large_const_arrays`: Check HIR tree first.
Jarcho Jun 13, 2024
430c02c
`large_enum_variant`: Delay macro check
Jarcho Jun 13, 2024
c3dd028
`large_futures`: Delay macro check
Jarcho Jun 13, 2024
03036c1
`large_include_file`: Check HIR tree first.
Jarcho Jun 13, 2024
5ae33c7
`legacy_numeric_constants`: Check HIR tree first.
Jarcho Jun 13, 2024
eac1aab
Reduce the size of lintcheck JSON output
Alexendoo Jul 7, 2024
ff4e62d
`len_zero`: Check HIR tree first
Jarcho Jun 13, 2024
fed75b3
`let_if_seq`: use `array_windows`.
Jarcho Jun 13, 2024
5332def
`let_underscore`: Delay macro check.
Jarcho Jun 13, 2024
15f640a
`let_with_type_underscore`:
Jarcho Jun 13, 2024
c0fa6a9
`literal_representation`: Delay macro check.
Jarcho Jun 13, 2024
b9ba340
`manual_bits`: Delay msrv check
Jarcho Jun 13, 2024
95348ad
`manual_float_methods`:
Jarcho Jun 13, 2024
2d9e67e
`manual_let_else`: Delay msrv and macro checks.
Jarcho Jun 13, 2024
f46c981
`manual_main_separator_str`: Check HIR tree first.
Jarcho Jun 13, 2024
2309f8e
`manual_non_exhaustive`: Delay msrv check.
Jarcho Jun 13, 2024
44f87e8
`manual_range_patterns`: Delay macro check.
Jarcho Jun 13, 2024
0f4cd13
`manual_rem_euclid`: Check HIR tree first.
Jarcho Jun 13, 2024
0311702
`manual_retain`: Remove redundant match.
Jarcho Jun 13, 2024
c0068ba
`manual_slice_size_calculation`: Delay constant check.
Jarcho Jun 13, 2024
5d333e8
`manual_strip`: Delay msrv check.
Jarcho Jun 13, 2024
7a942a5
`manual_unwrap_or_default`: Check HIR tree first.
Jarcho Jun 13, 2024
488a545
`map_unit_fn`: Delay macro check
Jarcho Jun 13, 2024
eda45aa
`minmax`: use let chain
Jarcho Jun 13, 2024
5b7ffa1
Rework `init_numbered_fields`:
Jarcho Jun 12, 2024
1de41b1
Auto merge of #13068 - Jarcho:init_numbered, r=Alexendoo
bors Jul 8, 2024
1e3f8c6
Auto merge of #113128 - WaffleLapkin:become_trully_unuwuable, r=oli-o…
bors Jul 8, 2024
e82cfdc
Auto merge of #127476 - jieyouxu:rollup-16wyb0b, r=jieyouxu
bors Jul 8, 2024
08992d0
[`missing_const_for_fn`]: fix FP when arg ty is impl trait alias ty
J-ZhengLi Jul 8, 2024
a988389
Rollup merge of #127355 - aceArt-GmbH:126475, r=oli-obk
matthiaskrgr Jul 8, 2024
2ad8cdc
Auto merge of #13045 - J-ZhengLi:missing_const_for_fn_FP, r=blyxyas
bors Jul 8, 2024
edc6b00
Auto merge of #13064 - Alexendoo:lintcheck-shrink-json, r=xFrednet
bors Jul 8, 2024
dfb9253
Auto merge of #12870 - lrh2000:sig-drop-while, r=blyxyas
bors Jul 8, 2024
510cfe3
Auto merge of #13067 - Jarcho:misc_small3, r=Manishearth
bors Jul 8, 2024
d23df74
resolve code review comments
bitfield Jul 8, 2024
920cbcd
Move trait selection error reporting to its own top-level module
compiler-errors Jul 8, 2024
f6020fb
Auto merge of #13042 - Jarcho:almost_range, r=Manishearth
bors Jul 8, 2024
058e6ea
Auto merge of #13043 - Jarcho:assign_clone, r=Manishearth
bors Jul 8, 2024
e64236c
Auto merge of #13044 - Jarcho:bool_int, r=Manishearth
bors Jul 8, 2024
87f8a5b
Auto merge of #13056 - y21:rm-compiler-lint-functions, r=Manishearth
bors Jul 8, 2024
a067cd2
Replace incorrect suggested fix for `float_cmp`
sandersaares Jul 9, 2024
a04dbb0
Tidy the example code and ensure it builds as standalone snippets
sandersaares Jul 9, 2024
8fa406b
Auto merge of #13069 - Jarcho:misc_small4, r=Manishearth
bors Jul 9, 2024
c3a2406
Lintcheck: Refactor structs and only take one version per crate
xFrednet Jul 8, 2024
279494e
Auto merge of #13080 - xFrednet:00000-lintcheck-mv-stuff-and-things, …
bors Jul 9, 2024
e42a380
Revert accidental "Why restrict this?" change
sandersaares Jul 10, 2024
ab7c910
Auto merge of #13079 - sandersaares:u/sasaares/no-epsilon-guidance, r…
bors Jul 10, 2024
b012421
Auto merge of #12944 - Jarcho:overflow_check, r=y21
bors Jul 10, 2024
a987c30
Fix `iter_next_loop.rs` ui test
GuillaumeGomez Jul 10, 2024
8d3b1f9
Auto merge of #12984 - bitfield:fix_doc_nits_c, r=Alexendoo
bors Jul 10, 2024
ef3cfaa
Auto merge of #13081 - GuillaumeGomez:fix-iter_next_loop.rs, r=y21
bors Jul 10, 2024
1ced73e
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Jul 11, 2024
3b1266c
Bump nightly version -> 2024-07-11
flip1995 Jul 11, 2024
b794b8e
Auto merge of #13086 - flip1995:rustup, r=flip1995
bors Jul 11, 2024
2ed6ed4
Merge commit 'b794b8e08c16517a941dc598bb1483e8e12a8592' into clippy-s…
flip1995 Jul 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
4 changes: 2 additions & 2 deletions src/tools/clippy/.github/workflows/lintcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:

- name: Run lintcheck
if: steps.cache-json.outputs.cache-hit != 'true'
run: ./target/debug/lintcheck --format json
run: ./target/debug/lintcheck --format json --warn-all

- name: Upload base JSON
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
run: cargo build --manifest-path=lintcheck/Cargo.toml

- name: Run lintcheck
run: ./target/debug/lintcheck --format json
run: ./target/debug/lintcheck --format json --warn-all

- name: Upload head JSON
uses: actions/upload-artifact@v4
Expand Down
6 changes: 6 additions & 0 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5236,6 +5236,7 @@ Released 2018-09-13
[`boxed_local`]: https://rust-lang.github.io/rust-clippy/master/index.html#boxed_local
[`branches_sharing_code`]: https://rust-lang.github.io/rust-clippy/master/index.html#branches_sharing_code
[`builtin_type_shadow`]: https://rust-lang.github.io/rust-clippy/master/index.html#builtin_type_shadow
[`byte_char_slices`]: https://rust-lang.github.io/rust-clippy/master/index.html#byte_char_slices
[`bytes_count_to_len`]: https://rust-lang.github.io/rust-clippy/master/index.html#bytes_count_to_len
[`bytes_nth`]: https://rust-lang.github.io/rust-clippy/master/index.html#bytes_nth
[`cargo_common_metadata`]: https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata
Expand All @@ -5253,6 +5254,7 @@ Released 2018-09-13
[`cast_sign_loss`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
[`cast_slice_different_sizes`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_slice_different_sizes
[`cast_slice_from_raw_parts`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_slice_from_raw_parts
[`cfg_not_test`]: https://rust-lang.github.io/rust-clippy/master/index.html#cfg_not_test
[`char_lit_as_u8`]: https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8
[`chars_last_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#chars_last_cmp
[`chars_next_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#chars_next_cmp
Expand Down Expand Up @@ -5539,6 +5541,7 @@ Released 2018-09-13
[`manual_range_patterns`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_patterns
[`manual_rem_euclid`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_rem_euclid
[`manual_retain`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_retain
[`manual_rotate`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_rotate
[`manual_saturating_arithmetic`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_saturating_arithmetic
[`manual_slice_size_calculation`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_slice_size_calculation
[`manual_split_once`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_split_once
Expand Down Expand Up @@ -5587,6 +5590,7 @@ Released 2018-09-13
[`missing_assert_message`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_assert_message
[`missing_asserts_for_indexing`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_asserts_for_indexing
[`missing_const_for_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
[`missing_const_for_thread_local`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_thread_local
[`missing_docs_in_private_items`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_docs_in_private_items
[`missing_enforced_import_renames`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_enforced_import_renames
[`missing_errors_doc`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
Expand Down Expand Up @@ -5701,6 +5705,7 @@ Released 2018-09-13
[`panic`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic
[`panic_in_result_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic_in_result_fn
[`panic_params`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic_params
[`panicking_overflow_checks`]: https://rust-lang.github.io/rust-clippy/master/index.html#panicking_overflow_checks
[`panicking_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#panicking_unwrap
[`partial_pub_fields`]: https://rust-lang.github.io/rust-clippy/master/index.html#partial_pub_fields
[`partialeq_ne_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_ne_impl
Expand Down Expand Up @@ -5797,6 +5802,7 @@ Released 2018-09-13
[`semicolon_outside_block`]: https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_outside_block
[`separated_literal_suffix`]: https://rust-lang.github.io/rust-clippy/master/index.html#separated_literal_suffix
[`serde_api_misuse`]: https://rust-lang.github.io/rust-clippy/master/index.html#serde_api_misuse
[`set_contains_or_insert`]: https://rust-lang.github.io/rust-clippy/master/index.html#set_contains_or_insert
[`shadow_reuse`]: https://rust-lang.github.io/rust-clippy/master/index.html#shadow_reuse
[`shadow_same`]: https://rust-lang.github.io/rust-clippy/master/index.html#shadow_same
[`shadow_unrelated`]: https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
Expand Down
3 changes: 2 additions & 1 deletion src/tools/clippy/book/src/lint_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ Suppress lints whenever the suggested change would cause breakage for other crat
* [`enum_variant_names`](https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names)
* [`large_types_passed_by_value`](https://rust-lang.github.io/rust-clippy/master/index.html#large_types_passed_by_value)
* [`linkedlist`](https://rust-lang.github.io/rust-clippy/master/index.html#linkedlist)
* [`needless_pass_by_ref_mut`](https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut)
* [`option_option`](https://rust-lang.github.io/rust-clippy/master/index.html#option_option)
* [`rc_buffer`](https://rust-lang.github.io/rust-clippy/master/index.html#rc_buffer)
* [`rc_mutex`](https://rust-lang.github.io/rust-clippy/master/index.html#rc_mutex)
Expand Down Expand Up @@ -454,7 +455,7 @@ default configuration of Clippy. By default, any configuration will replace the
* `doc-valid-idents = ["ClipPy"]` would replace the default list with `["ClipPy"]`.
* `doc-valid-idents = ["ClipPy", ".."]` would append `ClipPy` to the default list.

**Default Value:** `["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "DevOps", "DirectX", "ECMAScript", "GPLv2", "GPLv3", "GitHub", "GitLab", "IPv4", "IPv6", "ClojureScript", "CoffeeScript", "JavaScript", "PureScript", "TypeScript", "WebAssembly", "NaN", "NaNs", "OAuth", "GraphQL", "OCaml", "OpenDNS", "OpenGL", "OpenMP", "OpenSSH", "OpenSSL", "OpenStreetMap", "OpenTelemetry", "WebGL", "WebGL2", "WebGPU", "TensorFlow", "TrueType", "iOS", "macOS", "FreeBSD", "TeX", "LaTeX", "BibTeX", "BibLaTeX", "MinGW", "CamelCase"]`
**Default Value:** `["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "DevOps", "DirectX", "ECMAScript", "GPLv2", "GPLv3", "GitHub", "GitLab", "IPv4", "IPv6", "ClojureScript", "CoffeeScript", "JavaScript", "PureScript", "TypeScript", "WebAssembly", "NaN", "NaNs", "OAuth", "GraphQL", "OCaml", "OpenDNS", "OpenGL", "OpenMP", "OpenSSH", "OpenSSL", "OpenStreetMap", "OpenTelemetry", "WebGL", "WebGL2", "WebGPU", "WebP", "OpenExr", "YCbCr", "sRGB", "TensorFlow", "TrueType", "iOS", "macOS", "FreeBSD", "TeX", "LaTeX", "BibTeX", "BibLaTeX", "MinGW", "CamelCase"]`

---
**Affected lints:**
Expand Down
4 changes: 4 additions & 0 deletions src/tools/clippy/clippy.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
avoid-breaking-exported-api = false

[[disallowed-methods]]
path = "rustc_lint::context::LintContext::lint"
reason = "this function does not add a link to our documentation, please use the `clippy_utils::diagnostics::span_lint*` functions instead"

[[disallowed-methods]]
path = "rustc_lint::context::LintContext::span_lint"
reason = "this function does not add a link to our documentation, please use the `clippy_utils::diagnostics::span_lint*` functions instead"
Expand Down
3 changes: 2 additions & 1 deletion src/tools/clippy/clippy_config/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const DEFAULT_DOC_VALID_IDENTS: &[&str] = &[
"OCaml",
"OpenDNS", "OpenGL", "OpenMP", "OpenSSH", "OpenSSL", "OpenStreetMap", "OpenTelemetry",
"WebGL", "WebGL2", "WebGPU",
"WebP", "OpenExr", "YCbCr", "sRGB",
"TensorFlow",
"TrueType",
"iOS", "macOS", "FreeBSD",
Expand Down Expand Up @@ -262,7 +263,7 @@ define_Conf! {
/// arithmetic-side-effects-allowed-unary = ["SomeType", "AnotherType"]
/// ```
(arithmetic_side_effects_allowed_unary: FxHashSet<String> = <_>::default()),
/// Lint: ENUM_VARIANT_NAMES, LARGE_TYPES_PASSED_BY_VALUE, TRIVIALLY_COPY_PASS_BY_REF, UNNECESSARY_WRAPS, UNUSED_SELF, UPPER_CASE_ACRONYMS, WRONG_SELF_CONVENTION, BOX_COLLECTION, REDUNDANT_ALLOCATION, RC_BUFFER, VEC_BOX, OPTION_OPTION, LINKEDLIST, RC_MUTEX, UNNECESSARY_BOX_RETURNS, SINGLE_CALL_FN.
/// Lint: ENUM_VARIANT_NAMES, LARGE_TYPES_PASSED_BY_VALUE, TRIVIALLY_COPY_PASS_BY_REF, UNNECESSARY_WRAPS, UNUSED_SELF, UPPER_CASE_ACRONYMS, WRONG_SELF_CONVENTION, BOX_COLLECTION, REDUNDANT_ALLOCATION, RC_BUFFER, VEC_BOX, OPTION_OPTION, LINKEDLIST, RC_MUTEX, UNNECESSARY_BOX_RETURNS, SINGLE_CALL_FN, NEEDLESS_PASS_BY_REF_MUT.
///
/// Suppress lints whenever the suggested change would cause breakage for other crates.
(avoid_breaking_exported_api: bool = true),
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_config/src/msrvs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ msrv_aliases! {
1,68,0 { PATH_MAIN_SEPARATOR_STR }
1,65,0 { LET_ELSE, POINTER_CAST_CONSTNESS }
1,63,0 { CLONE_INTO }
1,62,0 { BOOL_THEN_SOME, DEFAULT_ENUM_ATTRIBUTE }
1,59,0 { THREAD_LOCAL_INITIALIZER_CAN_BE_MADE_CONST }
1,62,0 { BOOL_THEN_SOME, DEFAULT_ENUM_ATTRIBUTE, CONST_EXTERN_FN }
1,59,0 { THREAD_LOCAL_CONST_INIT }
1,58,0 { FORMAT_ARGS_CAPTURE, PATTERN_TRAIT_CHAR_ARRAY, CONST_RAW_PTR_DEREF }
1,56,0 { CONST_FN_UNION }
1,55,0 { SEEK_REWIND }
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_dev/src/new_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String {
result.push_str(&if enable_msrv {
formatdoc!(
r#"
use clippy_utils::msrvs::{{self, Msrv}};
use clippy_config::msrvs::{{self, Msrv}};
{pass_import}
use rustc_lint::{{{context_import}, {pass_type}, LintContext}};
use rustc_session::impl_lint_pass;
Expand Down Expand Up @@ -399,7 +399,7 @@ fn create_lint_for_ty(lint: &LintData<'_>, enable_msrv: bool, ty: &str) -> io::R
let _: fmt::Result = writedoc!(
lint_file_contents,
r#"
use clippy_utils::msrvs::{{self, Msrv}};
use clippy_config::msrvs::{{self, Msrv}};
use rustc_lint::{{{context_import}, LintContext}};

use super::{name_upper};
Expand Down
104 changes: 61 additions & 43 deletions src/tools/clippy/clippy_lints/src/almost_complete_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use rustc_errors::Applicability;
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
use rustc_middle::lint::in_external_macro;
use rustc_session::impl_lint_pass;
use rustc_span::Span;

declare_clippy_lint! {
/// ### What it does
Expand Down Expand Up @@ -41,61 +40,80 @@ impl AlmostCompleteRange {
}
impl EarlyLintPass for AlmostCompleteRange {
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &Expr) {
if let ExprKind::Range(Some(start), Some(end), RangeLimits::HalfOpen) = &e.kind {
let ctxt = e.span.ctxt();
let sugg = if let Some(start) = walk_span_to_context(start.span, ctxt)
&& let Some(end) = walk_span_to_context(end.span, ctxt)
&& self.msrv.meets(msrvs::RANGE_INCLUSIVE)
{
Some((trim_span(cx.sess().source_map(), start.between(end)), "..="))
} else {
None
};
check_range(cx, e.span, start, end, sugg);
if let ExprKind::Range(Some(start), Some(end), RangeLimits::HalfOpen) = &e.kind
&& is_incomplete_range(start, end)
&& !in_external_macro(cx.sess(), e.span)
{
span_lint_and_then(
cx,
ALMOST_COMPLETE_RANGE,
e.span,
"almost complete ascii range",
|diag| {
let ctxt = e.span.ctxt();
if let Some(start) = walk_span_to_context(start.span, ctxt)
&& let Some(end) = walk_span_to_context(end.span, ctxt)
&& self.msrv.meets(msrvs::RANGE_INCLUSIVE)
{
diag.span_suggestion(
trim_span(cx.sess().source_map(), start.between(end)),
"use an inclusive range",
"..=".to_owned(),
Applicability::MaybeIncorrect,
);
}
},
);
}
}

fn check_pat(&mut self, cx: &EarlyContext<'_>, p: &Pat) {
if let PatKind::Range(Some(start), Some(end), kind) = &p.kind
&& matches!(kind.node, RangeEnd::Excluded)
&& is_incomplete_range(start, end)
&& !in_external_macro(cx.sess(), p.span)
{
let sugg = if self.msrv.meets(msrvs::RANGE_INCLUSIVE) {
"..="
} else {
"..."
};
check_range(cx, p.span, start, end, Some((kind.span, sugg)));
span_lint_and_then(
cx,
ALMOST_COMPLETE_RANGE,
p.span,
"almost complete ascii range",
|diag| {
diag.span_suggestion(
kind.span,
"use an inclusive range",
if self.msrv.meets(msrvs::RANGE_INCLUSIVE) {
"..=".to_owned()
} else {
"...".to_owned()
},
Applicability::MaybeIncorrect,
);
},
);
}
}

extract_msrv_attr!(EarlyContext);
}

fn check_range(cx: &EarlyContext<'_>, span: Span, start: &Expr, end: &Expr, sugg: Option<(Span, &str)>) {
if let ExprKind::Lit(start_token_lit) = start.peel_parens().kind
&& let ExprKind::Lit(end_token_lit) = end.peel_parens().kind
&& matches!(
(
LitKind::from_token_lit(start_token_lit),
LitKind::from_token_lit(end_token_lit),
),
(
Ok(LitKind::Byte(b'a') | LitKind::Char('a')),
Ok(LitKind::Byte(b'z') | LitKind::Char('z'))
) | (
Ok(LitKind::Byte(b'A') | LitKind::Char('A')),
Ok(LitKind::Byte(b'Z') | LitKind::Char('Z')),
) | (
Ok(LitKind::Byte(b'0') | LitKind::Char('0')),
Ok(LitKind::Byte(b'9') | LitKind::Char('9')),
fn is_incomplete_range(start: &Expr, end: &Expr) -> bool {
match (&start.peel_parens().kind, &end.peel_parens().kind) {
(&ExprKind::Lit(start_lit), &ExprKind::Lit(end_lit)) => {
matches!(
(LitKind::from_token_lit(start_lit), LitKind::from_token_lit(end_lit),),
(
Ok(LitKind::Byte(b'a') | LitKind::Char('a')),
Ok(LitKind::Byte(b'z') | LitKind::Char('z'))
) | (
Ok(LitKind::Byte(b'A') | LitKind::Char('A')),
Ok(LitKind::Byte(b'Z') | LitKind::Char('Z')),
) | (
Ok(LitKind::Byte(b'0') | LitKind::Char('0')),
Ok(LitKind::Byte(b'9') | LitKind::Char('9')),
)
)
)
&& !in_external_macro(cx.sess(), span)
{
span_lint_and_then(cx, ALMOST_COMPLETE_RANGE, span, "almost complete ascii range", |diag| {
if let Some((span, sugg)) = sugg {
diag.span_suggestion(span, "use an inclusive range", sugg, Applicability::MaybeIncorrect);
}
});
},
_ => false,
}
}
20 changes: 10 additions & 10 deletions src/tools/clippy/clippy_lints/src/assertions_on_constants.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use clippy_utils::consts::{constant_with_source, Constant, ConstantSource};
use clippy_utils::consts::{constant, Constant};
use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::is_inside_always_const_context;
use clippy_utils::macros::{find_assert_args, root_macro_call_first_node, PanicExpn};
use rustc_hir::{Expr, Item, ItemKind, Node};
use rustc_hir::{Expr, ExprKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::declare_lint_pass;
use rustc_span::sym;
Expand Down Expand Up @@ -42,17 +43,16 @@ impl<'tcx> LateLintPass<'tcx> for AssertionsOnConstants {
let Some((condition, panic_expn)) = find_assert_args(cx, e, macro_call.expn) else {
return;
};
let Some((Constant::Bool(val), source)) = constant_with_source(cx, cx.typeck_results(), condition) else {
let Some(Constant::Bool(val)) = constant(cx, cx.typeck_results(), condition) else {
return;
};
if let ConstantSource::Constant = source
&& let Node::Item(Item {
kind: ItemKind::Const(..),
..
}) = cx.tcx.parent_hir_node(e.hir_id)
{
return;

match condition.kind {
ExprKind::Path(..) | ExprKind::Lit(_) => {},
_ if is_inside_always_const_context(cx.tcx, e.hir_id) => return,
_ => {},
}

if val {
span_lint_and_help(
cx,
Expand Down
Loading
Loading