File tree 3 files changed +20
-4
lines changed
3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -250,11 +250,12 @@ impl<'a> FmtVisitor<'a> {
250
250
true ,
251
251
) ) ;
252
252
253
- if force_newline_brace {
253
+ if self . config . fn_brace_style ( ) == BraceStyle :: AlwaysNextLine || force_newline_brace {
254
254
newline_brace = true ;
255
- } else if self . config . fn_brace_style ( ) != BraceStyle :: AlwaysNextLine
256
- && !result. contains ( '\n' )
257
- {
255
+ } else if last_line_width ( & result) + 2 > self . shape ( ) . width {
256
+ // 2 = ` {`
257
+ newline_brace = true ;
258
+ } else if !result. contains ( '\n' ) {
258
259
newline_brace = false ;
259
260
}
260
261
Original file line number Diff line number Diff line change @@ -52,3 +52,10 @@ pub fn waltz(cwd: &Path) -> CliAssert {
52
52
}
53
53
}
54
54
}
55
+
56
+ // #2003
57
+ mod foo {
58
+ fn __bindgen_test_layout_i_open0_c_open1_char_a_open2_char_close2_close1_close0_instantiation ( ) {
59
+ foo ( ) ;
60
+ }
61
+ }
Original file line number Diff line number Diff line change @@ -93,3 +93,11 @@ pub fn waltz(cwd: &Path) -> CliAssert {
93
93
}
94
94
}
95
95
}
96
+
97
+ // #2003
98
+ mod foo {
99
+ fn __bindgen_test_layout_i_open0_c_open1_char_a_open2_char_close2_close1_close0_instantiation ( )
100
+ {
101
+ foo ( ) ;
102
+ }
103
+ }
You can’t perform that action at this time.
0 commit comments