@@ -467,6 +467,26 @@ define_Conf! {
467467 /// Whether to check MSRV compatibility in `#[test]` and `#[cfg(test)]` code.
468468 #[ lints( incompatible_msrv) ]
469469 check_incompatible_msrv_in_tests: bool = false ,
470+ /// Whether to suggest reordering constructor fields when initializers are present.
471+ ///
472+ /// Warnings produced by this configuration aren't necessarily fixed by just reordering the fields. Even if the
473+ /// suggested code would compile, it can change semantics if the initializer expressions have side effects. The
474+ /// following example [from rust-clippy#11846] shows how the suggestion can run into borrow check errors:
475+ ///
476+ /// ```rust
477+ /// struct MyStruct {
478+ /// vector: Vec<u32>,
479+ /// length: usize
480+ /// }
481+ /// fn main() {
482+ /// let vector = vec![1,2,3];
483+ /// MyStruct { length: vector.len(), vector};
484+ /// }
485+ /// ```
486+ ///
487+ /// [from rust-clippy#11846]: https://github.com/rust-lang/rust-clippy/issues/11846#issuecomment-1820747924
488+ #[ lints( inconsistent_struct_constructor) ]
489+ check_inconsistent_struct_field_initializers: bool = false ,
470490 /// Whether to also run the listed lints on private items.
471491 #[ lints( missing_errors_doc, missing_panics_doc, missing_safety_doc, unnecessary_safety_doc) ]
472492 check_private_items: bool = false ,
@@ -542,25 +562,10 @@ define_Conf! {
542562 /// The maximum size of the `Err`-variant in a `Result` returned from a function
543563 #[ lints( result_large_err) ]
544564 large_error_threshold: u64 = 128 ,
545- /// Whether to suggest reordering constructor fields when initializers are present.
546- ///
547- /// Warnings produced by this configuration aren't necessarily fixed by just reordering the fields. Even if the
548- /// suggested code would compile, it can change semantics if the initializer expressions have side effects. The
549- /// following example [from rust-clippy#11846] shows how the suggestion can run into borrow check errors:
550- ///
551- /// ```rust
552- /// struct MyStruct {
553- /// vector: Vec<u32>,
554- /// length: usize
555- /// }
556- /// fn main() {
557- /// let vector = vec![1,2,3];
558- /// MyStruct { length: vector.len(), vector};
559- /// }
560- /// ```
565+ /// DEPRECATED CONFIGURATION: lint-inconsistent-struct-field-initializers
561566 ///
562- /// [from rust-clippy#11846]: https://github.com/rust-lang/rust-clippy/issues/11846#issuecomment-1820747924
563- #[ lints ( inconsistent_struct_constructor ) ]
567+ /// Use the `check-inconsistent-struct-field-initializers` configuration instead.
568+ #[ conf_deprecated ( "Please use `check-inconsistent-struct-field-initializers` instead" , check_inconsistent_struct_field_initializers ) ]
564569 lint_inconsistent_struct_field_initializers: bool = false ,
565570 /// The lower bound for linting decimal literals
566571 #[ lints( decimal_literal_representation) ]
0 commit comments