@@ -474,6 +474,26 @@ define_Conf! {
474
474
/// Whether to check MSRV compatibility in `#[test]` and `#[cfg(test)]` code.
475
475
#[ lints( incompatible_msrv) ]
476
476
check_incompatible_msrv_in_tests: bool = false ,
477
+ /// Whether to suggest reordering constructor fields when initializers are present.
478
+ ///
479
+ /// Warnings produced by this configuration aren't necessarily fixed by just reordering the fields. Even if the
480
+ /// suggested code would compile, it can change semantics if the initializer expressions have side effects. The
481
+ /// following example [from rust-clippy#11846] shows how the suggestion can run into borrow check errors:
482
+ ///
483
+ /// ```rust
484
+ /// struct MyStruct {
485
+ /// vector: Vec<u32>,
486
+ /// length: usize
487
+ /// }
488
+ /// fn main() {
489
+ /// let vector = vec![1,2,3];
490
+ /// MyStruct { length: vector.len(), vector};
491
+ /// }
492
+ /// ```
493
+ ///
494
+ /// [from rust-clippy#11846]: https://github.com/rust-lang/rust-clippy/issues/11846#issuecomment-1820747924
495
+ #[ lints( inconsistent_struct_constructor) ]
496
+ check_inconsistent_struct_field_initializers: bool = false ,
477
497
/// Whether to also run the listed lints on private items.
478
498
#[ lints( missing_errors_doc, missing_panics_doc, missing_safety_doc, unnecessary_safety_doc) ]
479
499
check_private_items: bool = false ,
@@ -554,24 +574,10 @@ define_Conf! {
554
574
#[ lints( collapsible_if) ]
555
575
lint_commented_code: bool = false ,
556
576
/// Whether to suggest reordering constructor fields when initializers are present.
577
+ /// DEPRECATED CONFIGURATION: lint-inconsistent-struct-field-initializers
557
578
///
558
- /// Warnings produced by this configuration aren't necessarily fixed by just reordering the fields. Even if the
559
- /// suggested code would compile, it can change semantics if the initializer expressions have side effects. The
560
- /// following example [from rust-clippy#11846] shows how the suggestion can run into borrow check errors:
561
- ///
562
- /// ```rust
563
- /// struct MyStruct {
564
- /// vector: Vec<u32>,
565
- /// length: usize
566
- /// }
567
- /// fn main() {
568
- /// let vector = vec![1,2,3];
569
- /// MyStruct { length: vector.len(), vector};
570
- /// }
571
- /// ```
572
- ///
573
- /// [from rust-clippy#11846]: https://github.com/rust-lang/rust-clippy/issues/11846#issuecomment-1820747924
574
- #[ lints( inconsistent_struct_constructor) ]
579
+ /// Use the `check-inconsistent-struct-field-initializers` configuration instead.
580
+ #[ conf_deprecated( "Please use `check-inconsistent-struct-field-initializers` instead" , check_inconsistent_struct_field_initializers) ]
575
581
lint_inconsistent_struct_field_initializers: bool = false ,
576
582
/// The lower bound for linting decimal literals
577
583
#[ lints( decimal_literal_representation) ]
0 commit comments