Commit graph

399 commits

Author SHA1 Message Date
Yotam Ofek
52a3082056 add manual_abs_diff lint 2025-04-02 19:40:14 +00:00
Timo
d88818d1e7
Rename inconsistent_struct_constructor configuration; don't suggest deprecated configurations (#14280)
This PR does two things:
- It renames `inconsistent_struct_constructor`'s configuration from
`lint-inconsistent-struct-field-initializers` to
`check-inconsistent-struct-field-initializers`. (I should have suggested
`check-...` in
[#13737](https://github.com/rust-lang/rust-clippy/pull/13737#discussion_r1875118516).)
- It causes Clippy to no longer suggest deprecated configurations.
(Previously, Clippy would suggest `cyclomatic-complexity-threshold`, for
example.)

r? @y21

changelog: Rename `lint-inconsistent-struct-field-initializers` to
`check-inconsistent-struct-field-initializers`
changelog: No longer suggest deprecated configurations
2025-03-25 11:56:47 +00:00
Timo
9c6cb5150f
wildcard_imports: lint on pub use if asked to (#14182)
`warn_on_all_wildcard_imports` should warn on all wildcard imports,
including the reexported ones.

Fix #13660

changelog: [`warn_on_all_wildcard_imports`]: when asked to warn on all
wildcard imports, include the reexported ones
2025-03-25 00:08:45 +00:00
Samuel Tardieu
809c931804 wildcard_imports: lint on pub use if asked to
`warn_on_all_wildcard_imports` should warn on all wildcard imports,
including the reexported ones.
2025-03-24 15:49:29 +01:00
Samuel Moelius
88b590bf46 lint-inconsistent-... -> check-inconsistent-... 2025-03-23 15:22:37 -04:00
Philipp Krones
e9aed8764e
set concurrency for the deploy job (#14448)
In the current GitHub Actions CI/CD setup, the `deploy` job is not
triggered when a PR is enqueued in the merge queue but only when it is
merged. Since concurrency is not configured for this job, deployments
may fail for later PRs if multiple PRs are merged in quick succession.
(e.g. the deployment for [this
commit](c418714518)
was successful, but the deployment for [this
commit](0a141ab7b8)
that was pushed to `main` immediately afterward failed. (edit: the
latter deployment seems to be rerun))

changelog: none

r? flip1995
2025-03-23 12:15:07 +00:00
lapla-cogito
3786c07463
remove the notation of the deploy job 2025-03-23 21:09:28 +09:00
Philipp Krones
cad9083d71
Lint more cases in collapsible_if (#14231)
Replace the use of `Sugg::ast()` which prevented combining `if` together
when they contained comments by span manipulation.

A new configuration option `lint_commented_code`, which is `true` by
default, allows opting out from this behavior.

If reviewed on GitHub, the second commit of this PR is best looked at
side by side, with whitespace differences turned off.

changelog: [`collapsible_if`]: lint more cases
2025-03-23 11:17:46 +00:00
Alex Macleod
c033a4c741
Document and improve (a lot) lintcheck --perf (#14194)
In #14116 we added a benchmarking option for Lintcheck, this commit adds
a new chapter to the book AND improves that option into a more usable
state.

It's recommended to review one commit at a time.

- **Document how to benchmark with lintcheck --perf**
- **Several improvements on lintcheck perf (desc.)**

    - Now lintcheck perf deletes target directory after benchmarking,
benchmarking with a cache isn't very useful or telling of any
precise outcome.

    - Support for benchmarking several times without having to do
a cargo clean.

    - Compress perf.data

changelog: none
2025-03-23 00:01:53 +00:00
Samuel Tardieu
82381608c9 Lint more cases in collapsible_if
Replace the use of `Sugg::ast()` which prevented combining `if`
together when they contained comments by span manipulation.

A new configuration option `lint_commented_code`, which is `true` by
default, opts out from this behavior.
2025-03-22 15:12:42 +01:00
Philipp Krones
e8e0126c18
Add comment annotations (#14414)
Fix missing comment annotations in the clippy book

changelog: none
2025-03-22 13:32:51 +00:00
lapla-cogito
19c7c46d48
rename rust-toolchain to rust-toolchain.toml 2025-03-21 09:37:59 +09:00
Jan Verbeek
d793c0abfa Add MSRV check for question_mark 2025-03-19 09:33:58 +01:00
Heshan Padmasiri
5d7e55cc11 Mention about .fixed files 2025-03-17 17:55:26 +05:30
xFrednet
9845b100ec
Remove @xFrednet from docs 👋 2025-03-16 15:19:49 +01:00
Heshan Padmasiri
ae3216e702 Add comment annotations 2025-03-16 18:52:35 +05:30
y21
44094e5148 explain is_from_proc_macro in the book 2025-03-12 18:25:25 +01:00
decryphe
5df68878bf Make alphabetic ordering in module item groups configurable (new default: off)
From feedback to this lint after its inclusion in clippy 1.82, this has
turned out to be the most requested improvement. With this improvement,
it is possible to make the lint check certain top-level structural
checks on modules (e.g. use statements and module inclusions at the top),
but still leaving everything else up to the developer.
2025-03-04 09:50:47 +01:00
Alex Macleod
0972c3b565 Check for MSRV attributes in late passes using the HIR 2025-02-28 18:09:44 +00:00
Timo
2cdb90d961
New lint: manual_midpoint (#13851)
changelog: [`manual_midpoint`]: new lint

Closes #13849
2025-02-28 16:27:34 +00:00
Alejandra González
e1c1ac1592
configuration option to lint incompatible_msrv in test code (#14279)
fixes #14277

changelog: [`incompatible_msrv`]: add config option
[`check-incompatible-msrv-in-tests`] to enable in `#[test]` and
`#[cfg(test)]` code.
2025-02-28 12:41:46 +00:00
Samuel Tardieu
baadee8fd3 New lint: manual_midpoint 2025-02-27 22:12:16 +01:00
Bryce Berger
325bfef88d
configuration option to lint incompatible_msrv in test code 2025-02-25 19:54:05 -05:00
Manish Goregaokar
35d5ee0e41
add MSRV check for repeat_vec_with_capacity (#14126)
changelog: [`repeat_vec_with_capacity`]: add MSRV check
2025-02-23 15:50:44 +00:00
Andre Bogus
6366cca439 add io_other_error lint 2025-02-21 22:08:31 +01:00
Alejandra González
649cef0e81
rename MANUAL_DIV_CEIL MSRV alias and add missing conf info for manual_div_ceil (#14263)
- The name of an MSRV alias should describe its functionality, and it is
not appropriate for it to be the same as the name of the lint that uses
it.
- Additionally, while `manual_div_ceil` allows setting MSRV, this is not
correctly reflected in the configuration information.

changelog: none
2025-02-21 18:02:30 +00:00
lapla-cogito
55f32d9259
add missing MSRV configuration information for manual_div_ceil 2025-02-20 23:27:15 +09:00
Andre Bogus
83f5cbad18 add owned_cow lint 2025-02-19 23:12:46 +01:00
lapla-cogito
939429a8b9
update rustfix link 2025-02-19 05:50:45 +09:00
Philipp Krones
8ae4750155
fix broken link of UI test in the book (#14077)
r? flip1995

changelog: none
2025-02-13 09:47:06 +00:00
llogiq
4129f5c824
New lint: mem_replace_option_with_some (#14197)
`mem::replace(opt, Some(v))` can be replaced by `opt.replace(v)`.

Close #14195

changelog: [`mem_replace_option_with_some`]: new lint
2025-02-12 19:02:06 +00:00
Samuel Tardieu
342ac8ee28 New lint: mem_replace_option_with_some
`mem::replace(opt, Some(v))` can be replaced by `opt.replace(v)`.
2025-02-12 19:57:14 +01:00
Samuel Tardieu
da6a05977d {expect,unwrap}_used: add options to lint at compilation time
By default, do not lint `.unwrap()` and `.expect(…)` in always const
contexts, as a failure would be detected at compile time anyway.

New options `allow_expect_in_consts` and `allow_unwrap_in_consts`,
defaulting to `true`, can be turned unset to still lint in always const
contexts.
2025-02-11 22:14:52 +01:00
blyxyas
4035fc2b72 Follow remark guidelines 2025-02-10 23:50:15 +01:00
blyxyas
e0175f8b8b Document how to benchmark with lintcheck --perf
Introducing a new chapter to the book, known as "Benchmarking Clippy".
It explains the benchmarking capabilities of lintcheck --perf
and gives a concrete example on how benchmark and compare a PR with
master
2025-02-10 23:32:57 +01:00
lapla-cogito
749eb371bf
correct "Affected lints" for allow-one-hash-in-raw-strings 2025-02-10 20:20:27 +09:00
dswij
5211148dbd
add MSRV check for manual_flatten (#14086)
`manual_flatten` should respect MSRV.

changelog: [`manual_flatten`]: add MSRV check
2025-02-08 04:17:43 +00:00
Catherine Flores
c6a861615e
add manual_option_as_slice MSRV to the lint documentation (#14171)
`manual_option_as_slice` takes MSRV into account, but this is not
mentioned in the lint documentation.

changelog: none
2025-02-07 12:28:06 +00:00
Catherine Flores
b0ad06daa8
add MSRV check for lines_filter_map_ok (#14130)
fixes #14127

changelog: [`lines_filter_map_ok`]: respect MSRV
2025-02-07 12:24:50 +00:00
lapla-cogito
16781bf29d
add manual_option_as_slice to the lint documentation 2025-02-07 21:00:39 +09:00
Philipp Krones
f549562b81
Merge remote-tracking branch 'upstream/master' into rustup 2025-02-06 14:31:01 +01:00
Philipp Krones
660d861058
Fix docs for #[clippy::format_args] (#14161)
changelog: none
2025-02-06 09:23:50 +00:00
Philipp Krones
ee1c15eb56
Add Nursery and Deprecated groups section at Book (#13926)
[RFC](https://github.com/rust-lang/rfcs/blob/master/text/2476-clippy-uno.md#lint-audit-and-categories)
has more groups so add them

changelog: none
2025-02-06 09:23:22 +00:00
Yuri Astrakhan
694b245b20 Fix docs for #[clippy::format_args] 2025-02-06 03:21:49 -05:00
Alexey Semenyuk
c718ae8e2d Add Nursery and Deprecated lints section at Book 2025-02-05 23:09:08 +05:00
llogiq
2c51951dba
add manual_slice_fill lint (#14082)
close #13856

changelog: [`manual_slice_fill`]: new lint
2025-02-03 05:03:14 +00:00
lapla-cogito
e82b1f4653
add manual_slice_fill lint 2025-02-03 10:09:39 +09:00
Nicholas Nethercote
d30f045fce Convert two rustc_middle::lint functions to Span methods.
`rustc_middle` is a huge crate and it's always good to move stuff out of
it. There are lots of similar methods already on `Span`, so these two
functions, `in_external_macro` and `is_from_async_await`, fit right in.
The diff is big because `in_external_macro` is used a lot by clippy
lints.
2025-02-02 13:57:34 +11:00
lapla-cogito
f9669e4caf
add MSRV check for lines_filter_map_ok 2025-02-01 15:20:34 +09:00
lapla-cogito
2a52fbe5da
add MSRV check for repeat_vec_with_capacity 2025-02-01 12:42:39 +09:00