@@ -106,6 +106,7 @@ create_config! {
106
106
// Misc.
107
107
remove_nested_parens: bool , true , true , "Remove nested parens" ;
108
108
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" ;
109
110
overflow_delimited_expr: bool , false , false ,
110
111
"Allow trailing bracket/brace delimited expressions to overflow" ;
111
112
struct_field_align_threshold: usize , 0 , false ,
@@ -589,6 +590,7 @@ spaces_around_ranges = false
589
590
binop_separator = "Front"
590
591
remove_nested_parens = true
591
592
combine_control_expr = true
593
+ short_item_threshold = 10
592
594
overflow_delimited_expr = false
593
595
struct_field_align_threshold = 0
594
596
enum_discrim_align_threshold = 0
@@ -902,6 +904,15 @@ make_backup = false
902
904
assert_eq ! ( config. single_line_if_else_max_width( ) , 70 ) ;
903
905
}
904
906
907
+ #[ test]
908
+ fn test_short_item_threshold_config_exceeds_max_width ( ) {
909
+ let toml = r#"
910
+ short_item_threshold = 10
911
+ "# ;
912
+ let config = Config :: from_toml ( toml, Path :: new ( "" ) ) . unwrap ( ) ;
913
+ assert_eq ! ( config. short_item_threshold( ) , 10 ) ;
914
+ }
915
+
905
916
#[ test]
906
917
fn test_override_fn_call_width_exceeds_max_width ( ) {
907
918
let mut config = Config :: default ( ) ;
@@ -950,5 +961,12 @@ make_backup = false
950
961
config. override_value ( "single_line_if_else_max_width" , "101" ) ;
951
962
assert_eq ! ( config. single_line_if_else_max_width( ) , 100 ) ;
952
963
}
964
+
965
+ #[ test]
966
+ fn test_override_short_item_threshold_exceeds_max_width ( ) {
967
+ let mut config = Config :: default ( ) ;
968
+ config. override_value ( "short_item_threshold" , "20" ) ;
969
+ assert_eq ! ( config. short_item_threshold( ) , 20 ) ;
970
+ }
953
971
}
954
972
}
0 commit comments