@@ -106,6 +106,7 @@ create_config! {
106106 // Misc.
107107 remove_nested_parens: bool , true , true , "Remove nested parens" ;
108108 combine_control_expr: bool , true , false , "Combine control expressions with function calls" ;
109+ short_item_threshold: usize , 10 , true , "Maximum width threshold for a short item" ;
109110 overflow_delimited_expr: bool , false , false ,
110111 "Allow trailing bracket/brace delimited expressions to overflow" ;
111112 struct_field_align_threshold: usize , 0 , false ,
@@ -591,6 +592,7 @@ spaces_around_ranges = false
591592binop_separator = "Front"
592593remove_nested_parens = true
593594combine_control_expr = true
595+ short_item_threshold = 10
594596overflow_delimited_expr = false
595597struct_field_align_threshold = 0
596598enum_discrim_align_threshold = 0
@@ -904,6 +906,15 @@ make_backup = false
904906 assert_eq ! ( config. single_line_if_else_max_width( ) , 70 ) ;
905907 }
906908
909+ #[ test]
910+ fn test_short_item_threshold_config_exceeds_max_width ( ) {
911+ let toml = r#"
912+ short_item_threshold = 10
913+ "# ;
914+ let config = Config :: from_toml ( toml, Path :: new ( "" ) ) . unwrap ( ) ;
915+ assert_eq ! ( config. short_item_threshold( ) , 10 ) ;
916+ }
917+
907918 #[ test]
908919 fn test_override_fn_call_width_exceeds_max_width ( ) {
909920 let mut config = Config :: default ( ) ;
@@ -952,5 +963,12 @@ make_backup = false
952963 config. override_value ( "single_line_if_else_max_width" , "101" ) ;
953964 assert_eq ! ( config. single_line_if_else_max_width( ) , 100 ) ;
954965 }
966+
967+ #[ test]
968+ fn test_override_short_item_threshold_exceeds_max_width ( ) {
969+ let mut config = Config :: default ( ) ;
970+ config. override_value ( "short_item_threshold" , "20" ) ;
971+ assert_eq ! ( config. short_item_threshold( ) , 20 ) ;
972+ }
955973 }
956974}
0 commit comments