@@ -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 ,
@@ -591,6 +592,7 @@ spaces_around_ranges = false
591
592
binop_separator = "Front"
592
593
remove_nested_parens = true
593
594
combine_control_expr = true
595
+ short_item_threshold = 10
594
596
overflow_delimited_expr = false
595
597
struct_field_align_threshold = 0
596
598
enum_discrim_align_threshold = 0
@@ -904,6 +906,15 @@ make_backup = false
904
906
assert_eq ! ( config. single_line_if_else_max_width( ) , 70 ) ;
905
907
}
906
908
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
+
907
918
#[ test]
908
919
fn test_override_fn_call_width_exceeds_max_width ( ) {
909
920
let mut config = Config :: default ( ) ;
@@ -952,5 +963,12 @@ make_backup = false
952
963
config. override_value ( "single_line_if_else_max_width" , "101" ) ;
953
964
assert_eq ! ( config. single_line_if_else_max_width( ) , 100 ) ;
954
965
}
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
+ }
955
973
}
956
974
}
0 commit comments