Skip to content

Commit 9141494

Browse files
authored
Merge branch 'rust-lang:master' into manual_checked_sub
2 parents 9a318a9 + 62f34f2 commit 9141494

File tree

506 files changed

+7892
-4625
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

506 files changed

+7892
-4625
lines changed

CHANGELOG.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,53 @@ document.
66

77
## Unreleased / Beta / In Rust Nightly
88

9-
[786fbd6d...master](https://github.com/rust-lang/rust-clippy/compare/786fbd6d...master)
9+
[609cd310...master](https://github.com/rust-lang/rust-clippy/compare/609cd310...master)
10+
11+
## Rust 1.85
12+
13+
Current stable, released 2025-02-20
14+
15+
[View all 72 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2024-11-15T19%3A31%3A08Z..2024-12-26T13%3A59%3A48Z+base%3Amaster)
16+
17+
### New Lints
18+
19+
* Added [`repr_packed_without_abi`] to `suspicious`
20+
[#13398](https://github.com/rust-lang/rust-clippy/pull/13398)
21+
* Added [`as_pointer_underscore`] to `restriction`
22+
[#13251](https://github.com/rust-lang/rust-clippy/pull/13251)
23+
* Added [`doc_nested_refdefs`] to `suspicious`
24+
[#13707](https://github.com/rust-lang/rust-clippy/pull/13707)
25+
* Added [`literal_string_with_formatting_args`] to `nursery`
26+
[#13410](https://github.com/rust-lang/rust-clippy/pull/13410)
27+
* Added [`doc_include_without_cfg`] to `restriction`
28+
[#13625](https://github.com/rust-lang/rust-clippy/pull/13625)
29+
30+
### Enhancements
31+
32+
* [`indexing_slicing`]: Can now be allowed in tests using the [`allow-indexing-slicing-in-tests`]
33+
configuration
34+
[#13854](https://github.com/rust-lang/rust-clippy/pull/13854)
35+
* [`if_let_mutex`]: disable lint from Edition 2024 since
36+
[if_let_rescope](https://github.com/rust-lang/rust/issues/131154) was stabilized
37+
[#13695](https://github.com/rust-lang/rust-clippy/pull/13695)
38+
* [`format_in_format_args`], [`recursive_format_impl`], [`to_string_in_format_args`],
39+
[`uninlined_format_args`], [`unused_format_specs`]: Can now support 3rd party format macros
40+
if they're marked with the `#[clippy::format_args]` attribute
41+
[#9948](https://github.com/rust-lang/rust-clippy/pull/9948)
42+
43+
### ICE Fixes
44+
45+
* [`trait_duplication_in_bounds`]: fix ICE on duplicate type or constant bound
46+
[#13722](https://github.com/rust-lang/rust-clippy/pull/13722)
47+
48+
### Others
49+
50+
* `clippy_utils` is now published to crates.io. Note that this crate is and will remain unstable.
51+
[#13700](https://github.com/rust-lang/rust-clippy/pull/13700)
1052

1153
## Rust 1.84
1254

13-
Current stable, released 2025-01-09
55+
Released 2025-01-09
1456

1557
[View all 84 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2024-10-03T21%3A23%3A58Z..2024-11-14T17%3A41%3A37Z+base%3Amaster)
1658

@@ -5550,6 +5592,7 @@ Released 2018-09-13
55505592
[`duplicated_attributes`]: https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes
55515593
[`duration_subsec`]: https://rust-lang.github.io/rust-clippy/master/index.html#duration_subsec
55525594
[`eager_transmute`]: https://rust-lang.github.io/rust-clippy/master/index.html#eager_transmute
5595+
[`elidable_lifetime_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#elidable_lifetime_names
55535596
[`else_if_without_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#else_if_without_else
55545597
[`empty_docs`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_docs
55555598
[`empty_drop`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_drop
@@ -5684,6 +5727,7 @@ Released 2018-09-13
56845727
[`invalid_utf8_in_unchecked`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_utf8_in_unchecked
56855728
[`inverted_saturating_sub`]: https://rust-lang.github.io/rust-clippy/master/index.html#inverted_saturating_sub
56865729
[`invisible_characters`]: https://rust-lang.github.io/rust-clippy/master/index.html#invisible_characters
5730+
[`io_other_error`]: https://rust-lang.github.io/rust-clippy/master/index.html#io_other_error
56875731
[`is_digit_ascii_radix`]: https://rust-lang.github.io/rust-clippy/master/index.html#is_digit_ascii_radix
56885732
[`items_after_statements`]: https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
56895733
[`items_after_test_module`]: https://rust-lang.github.io/rust-clippy/master/index.html#items_after_test_module
@@ -5764,6 +5808,7 @@ Released 2018-09-13
57645808
[`manual_main_separator_str`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_main_separator_str
57655809
[`manual_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
57665810
[`manual_memcpy`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_memcpy
5811+
[`manual_midpoint`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_midpoint
57675812
[`manual_next_back`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_next_back
57685813
[`manual_non_exhaustive`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive
57695814
[`manual_ok_err`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_err
@@ -5943,6 +5988,7 @@ Released 2018-09-13
59435988
[`out_of_bounds_indexing`]: https://rust-lang.github.io/rust-clippy/master/index.html#out_of_bounds_indexing
59445989
[`overflow_check_conditional`]: https://rust-lang.github.io/rust-clippy/master/index.html#overflow_check_conditional
59455990
[`overly_complex_bool_expr`]: https://rust-lang.github.io/rust-clippy/master/index.html#overly_complex_bool_expr
5991+
[`owned_cow`]: https://rust-lang.github.io/rust-clippy/master/index.html#owned_cow
59465992
[`panic`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic
59475993
[`panic_in_result_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic_in_result_fn
59485994
[`panic_params`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic_params
@@ -6167,6 +6213,7 @@ Released 2018-09-13
61676213
[`unnecessary_box_returns`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_box_returns
61686214
[`unnecessary_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
61696215
[`unnecessary_clippy_cfg`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_clippy_cfg
6216+
[`unnecessary_debug_formatting`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_debug_formatting
61706217
[`unnecessary_fallible_conversions`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions
61716218
[`unnecessary_filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_filter_map
61726219
[`unnecessary_find_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_find_map
@@ -6298,6 +6345,7 @@ Released 2018-09-13
62986345
[`avoid-breaking-exported-api`]: https://doc.rust-lang.org/clippy/lint_configuration.html#avoid-breaking-exported-api
62996346
[`await-holding-invalid-types`]: https://doc.rust-lang.org/clippy/lint_configuration.html#await-holding-invalid-types
63006347
[`cargo-ignore-publish`]: https://doc.rust-lang.org/clippy/lint_configuration.html#cargo-ignore-publish
6348+
[`check-incompatible-msrv-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#check-incompatible-msrv-in-tests
63016349
[`check-private-items`]: https://doc.rust-lang.org/clippy/lint_configuration.html#check-private-items
63026350
[`cognitive-complexity-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#cognitive-complexity-threshold
63036351
[`disallowed-macros`]: https://doc.rust-lang.org/clippy/lint_configuration.html#disallowed-macros

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "clippy"
33
# begin autogenerated version
4-
version = "0.1.86"
4+
version = "0.1.87"
55
# end autogenerated version
66
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
77
repository = "https://github.com/rust-lang/rust-clippy"

book/src/development/adding_lints.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ from the lint to the code of the test file and compare that to the contents of a
169169
Use `cargo bless` to automatically generate the `.fixed` file while running
170170
the tests.
171171

172-
[rustfix]: https://github.com/rust-lang/rustfix
172+
[rustfix]: https://github.com/rust-lang/cargo/tree/master/crates/rustfix
173173

174174
## Testing manually
175175

@@ -460,7 +460,7 @@ pub struct ManualStrip {
460460

461461
impl ManualStrip {
462462
pub fn new(conf: &'static Conf) -> Self {
463-
Self { msrv: conf.msrv.clone() }
463+
Self { msrv: conf.msrv }
464464
}
465465
}
466466
```
@@ -469,24 +469,13 @@ The project's MSRV can then be matched against the feature MSRV in the LintPass
469469
using the `Msrv::meets` method.
470470

471471
``` rust
472-
if !self.msrv.meets(msrvs::STR_STRIP_PREFIX) {
472+
if !self.msrv.meets(cx, msrvs::STR_STRIP_PREFIX) {
473473
return;
474474
}
475475
```
476476

477-
The project's MSRV can also be specified as an attribute, which overrides
478-
the value from `clippy.toml`. This can be accounted for using the
479-
`extract_msrv_attr!(LintContext)` macro and passing
480-
`LateContext`/`EarlyContext`.
481-
482-
```rust,ignore
483-
impl<'tcx> LateLintPass<'tcx> for ManualStrip {
484-
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
485-
...
486-
}
487-
extract_msrv_attr!(LateContext);
488-
}
489-
```
477+
Early lint passes should instead use `MsrvStack` coupled with
478+
`extract_msrv_attr!()`
490479

491480
Once the `msrv` is added to the lint, a relevant test case should be added to
492481
the lint's test file, `tests/ui/manual_strip.rs` in this example. It should
@@ -512,8 +501,16 @@ in `clippy_config/src/conf.rs`:
512501

513502
```rust
514503
define_Conf! {
515-
/// Lint: LIST, OF, LINTS, <THE_NEWLY_ADDED_LINT>. The minimum rust version that the project supports
516-
(msrv: Option<String> = None),
504+
#[lints(
505+
allow_attributes,
506+
allow_attributes_without_reason,
507+
..
508+
<the newly added lint name>,
509+
..
510+
unused_trait_names,
511+
use_self,
512+
)]
513+
msrv: Msrv = Msrv::default(),
517514
...
518515
}
519516
```

book/src/development/writing_tests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ We'll talk about suggestions more in depth in a [later chapter](emitting_lints.m
203203
Use `cargo bless` to automatically generate the `.fixed` file after running
204204
the tests.
205205

206-
[`rustfix`]: https://github.com/rust-lang/rustfix
206+
[`rustfix`]: https://github.com/rust-lang/cargo/tree/master/crates/rustfix
207207
[`span_lint_and_sugg`]: https://doc.rust-lang.org/beta/nightly-rustc/clippy_utils/diagnostics/fn.span_lint_and_sugg.html
208208

209209
## Testing Manually

book/src/lint_configuration.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ Suppress lints whenever the suggested change would cause breakage for other crat
380380
* [`linkedlist`](https://rust-lang.github.io/rust-clippy/master/index.html#linkedlist)
381381
* [`needless_pass_by_ref_mut`](https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut)
382382
* [`option_option`](https://rust-lang.github.io/rust-clippy/master/index.html#option_option)
383+
* [`owned_cow`](https://rust-lang.github.io/rust-clippy/master/index.html#owned_cow)
383384
* [`rc_buffer`](https://rust-lang.github.io/rust-clippy/master/index.html#rc_buffer)
384385
* [`rc_mutex`](https://rust-lang.github.io/rust-clippy/master/index.html#rc_mutex)
385386
* [`redundant_allocation`](https://rust-lang.github.io/rust-clippy/master/index.html#redundant_allocation)
@@ -414,6 +415,16 @@ For internal testing only, ignores the current `publish` settings in the Cargo m
414415
* [`cargo_common_metadata`](https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata)
415416

416417

418+
## `check-incompatible-msrv-in-tests`
419+
Whether to check MSRV compatibility in `#[test]` and `#[cfg(test)]` code.
420+
421+
**Default Value:** `false`
422+
423+
---
424+
**Affected lints:**
425+
* [`incompatible_msrv`](https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv)
426+
427+
417428
## `check-private-items`
418429
Whether to also run the listed lints on private items.
419430

@@ -758,16 +769,19 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
758769
* [`from_over_into`](https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into)
759770
* [`if_then_some_else_none`](https://rust-lang.github.io/rust-clippy/master/index.html#if_then_some_else_none)
760771
* [`index_refutable_slice`](https://rust-lang.github.io/rust-clippy/master/index.html#index_refutable_slice)
772+
* [`io_other_error`](https://rust-lang.github.io/rust-clippy/master/index.html#io_other_error)
761773
* [`iter_kv_map`](https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map)
762774
* [`legacy_numeric_constants`](https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants)
763775
* [`lines_filter_map_ok`](https://rust-lang.github.io/rust-clippy/master/index.html#lines_filter_map_ok)
764776
* [`manual_bits`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_bits)
765777
* [`manual_c_str_literals`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals)
766778
* [`manual_clamp`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_clamp)
779+
* [`manual_div_ceil`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil)
767780
* [`manual_flatten`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten)
768781
* [`manual_hash_one`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_hash_one)
769782
* [`manual_is_ascii_check`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_ascii_check)
770783
* [`manual_let_else`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else)
784+
* [`manual_midpoint`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_midpoint)
771785
* [`manual_non_exhaustive`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive)
772786
* [`manual_option_as_slice`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_option_as_slice)
773787
* [`manual_pattern_char_comparison`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_pattern_char_comparison)
@@ -794,6 +808,7 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
794808
* [`ptr_as_ptr`](https://rust-lang.github.io/rust-clippy/master/index.html#ptr_as_ptr)
795809
* [`redundant_field_names`](https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names)
796810
* [`redundant_static_lifetimes`](https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes)
811+
* [`repeat_vec_with_capacity`](https://rust-lang.github.io/rust-clippy/master/index.html#repeat_vec_with_capacity)
797812
* [`same_item_push`](https://rust-lang.github.io/rust-clippy/master/index.html#same_item_push)
798813
* [`seek_from_current`](https://rust-lang.github.io/rust-clippy/master/index.html#seek_from_current)
799814
* [`seek_rewind`](https://rust-lang.github.io/rust-clippy/master/index.html#seek_rewind)

clippy_config/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "clippy_config"
33
# begin autogenerated version
4-
version = "0.1.86"
4+
version = "0.1.87"
55
# end autogenerated version
66
edition = "2024"
77
publish = false

clippy_config/src/conf.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ define_Conf! {
438438
linkedlist,
439439
needless_pass_by_ref_mut,
440440
option_option,
441+
owned_cow,
441442
rc_buffer,
442443
rc_mutex,
443444
redundant_allocation,
@@ -463,6 +464,9 @@ define_Conf! {
463464
/// For internal testing only, ignores the current `publish` settings in the Cargo manifest.
464465
#[lints(cargo_common_metadata)]
465466
cargo_ignore_publish: bool = false,
467+
/// Whether to check MSRV compatibility in `#[test]` and `#[cfg(test)]` code.
468+
#[lints(incompatible_msrv)]
469+
check_incompatible_msrv_in_tests: bool = false,
466470
/// Whether to also run the listed lints on private items.
467471
#[lints(missing_errors_doc, missing_panics_doc, missing_safety_doc, unnecessary_safety_doc)]
468472
check_private_items: bool = false,
@@ -613,16 +617,19 @@ define_Conf! {
613617
from_over_into,
614618
if_then_some_else_none,
615619
index_refutable_slice,
620+
io_other_error,
616621
iter_kv_map,
617622
legacy_numeric_constants,
618623
lines_filter_map_ok,
619624
manual_bits,
620625
manual_c_str_literals,
621626
manual_clamp,
627+
manual_div_ceil,
622628
manual_flatten,
623629
manual_hash_one,
624630
manual_is_ascii_check,
625631
manual_let_else,
632+
manual_midpoint,
626633
manual_non_exhaustive,
627634
manual_option_as_slice,
628635
manual_pattern_char_comparison,
@@ -649,6 +656,7 @@ define_Conf! {
649656
ptr_as_ptr,
650657
redundant_field_names,
651658
redundant_static_lifetimes,
659+
repeat_vec_with_capacity,
652660
same_item_push,
653661
seek_from_current,
654662
seek_rewind,
@@ -662,7 +670,7 @@ define_Conf! {
662670
unused_trait_names,
663671
use_self,
664672
)]
665-
msrv: Msrv = Msrv::empty(),
673+
msrv: Msrv = Msrv::default(),
666674
/// The minimum size (in bytes) to consider a type for passing by reference instead of by value.
667675
#[lints(large_types_passed_by_value)]
668676
pass_by_value_size_limit: u64 = 256,

clippy_dev/src/dogfood.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ use std::process::Command;
44
/// # Panics
55
///
66
/// Panics if unable to run the dogfood test
7-
pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool) {
7+
#[allow(clippy::fn_params_excessive_bools)]
8+
pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool, allow_no_vcs: bool) {
89
let mut cmd = Command::new("cargo");
910

1011
cmd.current_dir(clippy_project_root())
@@ -25,6 +26,10 @@ pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool) {
2526
dogfood_args.push("--allow-staged");
2627
}
2728

29+
if allow_no_vcs {
30+
dogfood_args.push("--allow-no-vcs");
31+
}
32+
2833
cmd.env("__CLIPPY_DOGFOOD_ARGS", dogfood_args.join(" "));
2934

3035
exit_if_err(cmd.status());

0 commit comments

Comments
 (0)