File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2675,7 +2675,12 @@ fn rewrite_fn_base(
26752675 . unwrap_or ( ret_shape)
26762676 } ;
26772677
2678- if multi_line_ret_str || ret_should_indent {
2678+ let exceeds_max_width = last_line_width ( & result) + ret_str_len > context. config . max_width ( ) ;
2679+
2680+ if multi_line_ret_str
2681+ || ret_should_indent
2682+ || ( context. config . style_edition ( ) >= StyleEdition :: Edition2027 && exceeds_max_width)
2683+ {
26792684 // Now that we know the proper indent and width, we need to
26802685 // re-layout the return type.
26812686 let ret_str = fd. output . rewrite_result ( context, ret_shape) ?;
Original file line number Diff line number Diff line change 1+ // rustfmt-style_edition: 2021
2+ // rustfmt-max_width: 100
3+
4+ impl < T : CapnpWrite >
5+ IntoMessage <
6+ capnp:: message:: TypedReader <
7+ capnp:: message:: Builder < capnp:: message:: HeapAllocator > ,
8+ T :: Capnp ,
9+ > ,
10+ > for T
11+ {
12+ // Incorrectly places the return type on a single line
13+ fn into_msg (
14+ self ,
15+ ) -> capnp:: message:: TypedReader <
16+ capnp:: message:: Builder < capnp:: message:: HeapAllocator > , T :: Capnp
17+ >
18+ {
19+ todo ! ( )
20+ }
21+ }
22+
23+ impl < T > Foo for T {
24+ fn into_msg_return_type_single_line_99 (
25+ self ,
26+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type____ >
27+ {
28+ todo ! ( )
29+ }
30+
31+ fn into_msg_return_type_single_line_100 (
32+ self ,
33+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type_____ >
34+ {
35+ todo ! ( )
36+ }
37+
38+ // Incorrectly places the return type on a single line
39+ fn into_msg_return_type_single_line_101 (
40+ self ,
41+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type______ >
42+ {
43+ todo ! ( )
44+ }
45+ }
46+
Original file line number Diff line number Diff line change 1+ // rustfmt-style_edition: 2024
2+ // rustfmt-max_width: 100
3+
4+ impl < T : CapnpWrite >
5+ IntoMessage <
6+ capnp:: message:: TypedReader <
7+ capnp:: message:: Builder < capnp:: message:: HeapAllocator > ,
8+ T :: Capnp ,
9+ > ,
10+ > for T
11+ {
12+ // Incorrectly places the return type on a single line
13+ fn into_msg (
14+ self ,
15+ ) -> capnp:: message:: TypedReader <
16+ capnp:: message:: Builder < capnp:: message:: HeapAllocator > , T :: Capnp
17+ >
18+ {
19+ todo ! ( )
20+ }
21+ }
22+
23+ impl < T > Foo for T {
24+ fn into_msg_return_type_single_line_99 (
25+ self ,
26+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type____ >
27+ {
28+ todo ! ( )
29+ }
30+
31+ fn into_msg_return_type_single_line_100 (
32+ self ,
33+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type_____ >
34+ {
35+ todo ! ( )
36+ }
37+
38+ // Incorrectly places the return type on a single line
39+ fn into_msg_return_type_single_line_101 (
40+ self ,
41+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type______ >
42+ {
43+ todo ! ( )
44+ }
45+ }
46+
Original file line number Diff line number Diff line change 1+ // rustfmt-style_edition: 2027
2+ // rustfmt-max_width: 100
3+
4+ impl < T : CapnpWrite >
5+ IntoMessage <
6+ capnp:: message:: TypedReader <
7+ capnp:: message:: Builder < capnp:: message:: HeapAllocator > ,
8+ T :: Capnp ,
9+ > ,
10+ > for T
11+ {
12+ fn into_msg (
13+ self ,
14+ ) -> capnp:: message:: TypedReader <
15+ capnp:: message:: Builder < capnp:: message:: HeapAllocator > , T :: Capnp
16+ >
17+ {
18+ todo ! ( )
19+ }
20+ }
21+
22+ impl < T > Foo for T {
23+ fn into_msg_return_type_single_line_99 (
24+ self ,
25+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type____ >
26+ {
27+ todo ! ( )
28+ }
29+
30+ fn into_msg_return_type_single_line_100 (
31+ self ,
32+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type_____ >
33+ {
34+ todo ! ( )
35+ }
36+
37+
38+ fn into_msg_return_type_single_line_101 (
39+ self ,
40+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type______ >
41+ {
42+ todo ! ( )
43+ }
44+ }
Original file line number Diff line number Diff line change 1+ // rustfmt-style_edition: 2021
2+ // rustfmt-max_width: 100
3+
4+ impl < T : CapnpWrite >
5+ IntoMessage <
6+ capnp:: message:: TypedReader <
7+ capnp:: message:: Builder < capnp:: message:: HeapAllocator > ,
8+ T :: Capnp ,
9+ > ,
10+ > for T
11+ {
12+ // Incorrectly places the return type on a single line
13+ fn into_msg (
14+ self ,
15+ ) -> capnp:: message:: TypedReader < capnp:: message:: Builder < capnp:: message:: HeapAllocator > , T :: Capnp >
16+ {
17+ todo ! ( )
18+ }
19+ }
20+
21+ impl < T > Foo for T {
22+ fn into_msg_return_type_single_line_99 (
23+ self ,
24+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type____ >
25+ {
26+ todo ! ( )
27+ }
28+
29+ fn into_msg_return_type_single_line_100 (
30+ self ,
31+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type_____ >
32+ {
33+ todo ! ( )
34+ }
35+
36+ // Incorrectly places the return type on a single line
37+ fn into_msg_return_type_single_line_101 (
38+ self ,
39+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type______ >
40+ {
41+ todo ! ( )
42+ }
43+ }
Original file line number Diff line number Diff line change 1+ // rustfmt-style_edition: 2024
2+ // rustfmt-max_width: 100
3+
4+ impl < T : CapnpWrite >
5+ IntoMessage <
6+ capnp:: message:: TypedReader <
7+ capnp:: message:: Builder < capnp:: message:: HeapAllocator > ,
8+ T :: Capnp ,
9+ > ,
10+ > for T
11+ {
12+ // Incorrectly places the return type on a single line
13+ fn into_msg (
14+ self ,
15+ ) -> capnp:: message:: TypedReader < capnp:: message:: Builder < capnp:: message:: HeapAllocator > , T :: Capnp >
16+ {
17+ todo ! ( )
18+ }
19+ }
20+
21+ impl < T > Foo for T {
22+ fn into_msg_return_type_single_line_99 (
23+ self ,
24+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type____ >
25+ {
26+ todo ! ( )
27+ }
28+
29+ fn into_msg_return_type_single_line_100 (
30+ self ,
31+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type_____ >
32+ {
33+ todo ! ( )
34+ }
35+
36+ // Incorrectly places the return type on a single line
37+ fn into_msg_return_type_single_line_101 (
38+ self ,
39+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type______ >
40+ {
41+ todo ! ( )
42+ }
43+ }
Original file line number Diff line number Diff line change 1+ // rustfmt-style_edition: 2027
2+ // rustfmt-max_width: 100
3+
4+ impl < T : CapnpWrite >
5+ IntoMessage <
6+ capnp:: message:: TypedReader <
7+ capnp:: message:: Builder < capnp:: message:: HeapAllocator > ,
8+ T :: Capnp ,
9+ > ,
10+ > for T
11+ {
12+ fn into_msg (
13+ self ,
14+ ) -> capnp:: message:: TypedReader <
15+ capnp:: message:: Builder < capnp:: message:: HeapAllocator > ,
16+ T :: Capnp ,
17+ > {
18+ todo ! ( )
19+ }
20+ }
21+
22+ impl < T > Foo for T {
23+ fn into_msg_return_type_single_line_99 (
24+ self ,
25+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type____ >
26+ {
27+ todo ! ( )
28+ }
29+
30+ fn into_msg_return_type_single_line_100 (
31+ self ,
32+ ) -> some:: long:: path:: to:: GenericType < long:: path:: to:: GenericType < some:: Type > , some:: Type_____ >
33+ {
34+ todo ! ( )
35+ }
36+
37+ fn into_msg_return_type_single_line_101 (
38+ self ,
39+ ) -> some:: long:: path:: to:: GenericType <
40+ long:: path:: to:: GenericType < some:: Type > ,
41+ some:: Type______ ,
42+ > {
43+ todo ! ( )
44+ }
45+ }
You can’t perform that action at this time.
0 commit comments