diff --git a/src/lists.rs b/src/lists.rs index f567a191e1f..fcb04004ad4 100644 --- a/src/lists.rs +++ b/src/lists.rs @@ -366,8 +366,8 @@ where // Block style in non-vertical mode. let block_mode = tactic == DefinitiveListTactic::Horizontal; // Width restriction is only relevant in vertical mode. - let comment = - rewrite_comment(comment, block_mode, formatting.shape, formatting.config)?; + let comment_shape = formatting.shape.comment(formatting.config); + let comment = rewrite_comment(comment, block_mode, comment_shape, formatting.config)?; result.push_str(&comment); if !inner_item.is_empty() { diff --git a/tests/target/comments-in-lists/wrap-comments-not-normalized.rs b/tests/target/comments-in-lists/wrap-comments-not-normalized.rs index 9b9147eb124..7cd41edbb13 100644 --- a/tests/target/comments-in-lists/wrap-comments-not-normalized.rs +++ b/tests/target/comments-in-lists/wrap-comments-not-normalized.rs @@ -19,11 +19,11 @@ pub enum E2 { } pub enum E3 { - // Expand as needed, numbers should be ascending according to the stage through the inclusion - // pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions Variant1, - // Expand as needed, numbers should be ascending according to the stage through the inclusion - // pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions Variant2, // Expand as needed, numbers should be ascending according to the stage through the inclusion // pipeline, or according to the descriptions @@ -47,11 +47,11 @@ pub struct S2 { } pub struct S3 { - // Expand as needed, numbers should be ascending according to the stage through the inclusion - // pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions some_field: usize, - // Expand as needed, numbers should be ascending according to the stage through the inclusion - // pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions last_field: usize, // Expand as needed, numbers should be ascending according to the stage through the inclusion // pipeline, or according to the descriptions @@ -77,11 +77,11 @@ fn foo2(// Expand as needed, numbers should be ascending according to the stage } fn foo3( - // Expand as needed, numbers should be ascending according to the stage through the inclusion - // pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions a: usize, - // Expand as needed, numbers should be ascending according to the stage through the inclusion - // pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions b: usize, // Expand as needed, numbers should be ascending according to the stage through the inclusion // pipeline, or according to the descriptions @@ -107,11 +107,11 @@ fn main() { ]; let v3 = vec![ - // Expand as needed, numbers should be ascending according to the stage through the - // inclusion pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions 1, - // Expand as needed, numbers should be ascending according to the stage through the - // inclusion pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions 2, // Expand as needed, numbers should be ascending according to the stage through the // inclusion pipeline, or according to the descriptions @@ -130,11 +130,11 @@ fn main() { } match a { - // Expand as needed, numbers should be ascending according to the stage through the - // inclusion pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions b => c, - // Expand as needed, numbers should be ascending according to the stage through the - // inclusion pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions d => e, // Expand as needed, numbers should be ascending according to the stage through the // inclusion pipeline, or according to the descriptions diff --git a/tests/target/comments-in-lists/wrap-comments-true.rs b/tests/target/comments-in-lists/wrap-comments-true.rs index c1531d22a4a..983d2ccd20f 100644 --- a/tests/target/comments-in-lists/wrap-comments-true.rs +++ b/tests/target/comments-in-lists/wrap-comments-true.rs @@ -20,11 +20,11 @@ pub enum E2 { } pub enum E3 { - // Expand as needed, numbers should be ascending according to the stage through the inclusion - // pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions Variant1, - // Expand as needed, numbers should be ascending according to the stage through the inclusion - // pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions Variant2, // Expand as needed, numbers should be ascending according to the stage through the inclusion // pipeline, or according to the descriptions @@ -48,11 +48,11 @@ pub struct S2 { } pub struct S3 { - // Expand as needed, numbers should be ascending according to the stage through the inclusion - // pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions some_field: usize, - // Expand as needed, numbers should be ascending according to the stage through the inclusion - // pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions last_field: usize, // Expand as needed, numbers should be ascending according to the stage through the inclusion // pipeline, or according to the descriptions @@ -78,11 +78,11 @@ fn foo2(// Expand as needed, numbers should be ascending according to the stage } fn foo3( - // Expand as needed, numbers should be ascending according to the stage through the inclusion - // pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions a: usize, - // Expand as needed, numbers should be ascending according to the stage through the inclusion - // pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions b: usize, // Expand as needed, numbers should be ascending according to the stage through the inclusion // pipeline, or according to the descriptions @@ -108,11 +108,11 @@ fn main() { ]; let v3 = vec![ - // Expand as needed, numbers should be ascending according to the stage through the - // inclusion pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions 1, - // Expand as needed, numbers should be ascending according to the stage through the - // inclusion pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions 2, // Expand as needed, numbers should be ascending according to the stage through the // inclusion pipeline, or according to the descriptions @@ -131,11 +131,11 @@ fn main() { } match a { - // Expand as needed, numbers should be ascending according to the stage through the - // inclusion pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions b => c, - // Expand as needed, numbers should be ascending according to the stage through the - // inclusion pipeline, or according to the descriptions + // Expand as needed, numbers should be ascending according to the stage + // through the inclusion pipeline, or according to the descriptions d => e, // Expand as needed, numbers should be ascending according to the stage through the // inclusion pipeline, or according to the descriptions diff --git a/tests/target/configs/struct_field_align_threshold/20.rs b/tests/target/configs/struct_field_align_threshold/20.rs index 12a523e9d83..20dd963d7b1 100644 --- a/tests/target/configs/struct_field_align_threshold/20.rs +++ b/tests/target/configs/struct_field_align_threshold/20.rs @@ -320,9 +320,9 @@ fn main() { }; A { - // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit - // amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante - // hendrerit. Donec et mollis dolor. + // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam + // lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam + // viverra nec consectetur ante hendrerit. Donec et mollis dolor. first: item(), // Praesent et diam eget libero egestas mattis sit amet vitae augue. // Nam tincidunt congue enim, ut porta lorem lacinia consectetur. diff --git a/tests/target/struct_lits.rs b/tests/target/struct_lits.rs index d3bc364c350..51789b8fb9c 100644 --- a/tests/target/struct_lits.rs +++ b/tests/target/struct_lits.rs @@ -39,9 +39,9 @@ fn main() { }; A { - // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit - // amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. - // Donec et mollis dolor. + // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam + // lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam + // viverra nec consectetur ante hendrerit. Donec et mollis dolor. first: item(), // Praesent et diam eget libero egestas mattis sit amet vitae augue. // Nam tincidunt congue enim, ut porta lorem lacinia consectetur. diff --git a/tests/target/struct_lits_multiline.rs b/tests/target/struct_lits_multiline.rs index b29aafd0548..2a03a116abe 100644 --- a/tests/target/struct_lits_multiline.rs +++ b/tests/target/struct_lits_multiline.rs @@ -49,9 +49,9 @@ fn main() { }; A { - // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit - // amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. - // Donec et mollis dolor. + // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam + // lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam + // viverra nec consectetur ante hendrerit. Donec et mollis dolor. first: item(), // Praesent et diam eget libero egestas mattis sit amet vitae augue. // Nam tincidunt congue enim, ut porta lorem lacinia consectetur. diff --git a/tests/target/struct_lits_visual.rs b/tests/target/struct_lits_visual.rs index a9627fb90f5..a78c689536d 100644 --- a/tests/target/struct_lits_visual.rs +++ b/tests/target/struct_lits_visual.rs @@ -32,9 +32,9 @@ fn main() { Baz { x: yxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, z: zzzzz /* test */ }; - A { // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit - // amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante - // hendrerit. Donec et mollis dolor. + A { // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam + // lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam + // viverra nec consectetur ante hendrerit. Donec et mollis dolor. first: item(), // Praesent et diam eget libero egestas mattis sit amet vitae augue. // Nam tincidunt congue enim, ut porta lorem lacinia consectetur. diff --git a/tests/target/struct_lits_visual_multiline.rs b/tests/target/struct_lits_visual_multiline.rs index 3f43ef0c981..5f52abb7f8a 100644 --- a/tests/target/struct_lits_visual_multiline.rs +++ b/tests/target/struct_lits_visual_multiline.rs @@ -32,9 +32,9 @@ fn main() { }, y: baz() }; - A { // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit - // amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante - // hendrerit. Donec et mollis dolor. + A { // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam + // lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam + // viverra nec consectetur ante hendrerit. Donec et mollis dolor. first: item(), // Praesent et diam eget libero egestas mattis sit amet vitae augue. // Nam tincidunt congue enim, ut porta lorem lacinia consectetur. diff --git a/tests/target/struct_tuple_visual.rs b/tests/target/struct_tuple_visual.rs index f95f3fe4fd3..d4e9586f1b2 100644 --- a/tests/target/struct_tuple_visual.rs +++ b/tests/target/struct_tuple_visual.rs @@ -19,9 +19,9 @@ fn foo() { Baz(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, zzzzz /* test */); - A(// Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit - // amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante - // hendrerit. Donec et mollis dolor. + A(// Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam + // lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam + // viverra nec consectetur ante hendrerit. Donec et mollis dolor. item(), // Praesent et diam eget libero egestas mattis sit amet vitae augue. // Nam tincidunt congue enim, ut porta lorem lacinia consectetur.