File tree Expand file tree Collapse file tree 4 files changed +20
-9
lines changed Expand file tree Collapse file tree 4 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -870,15 +870,14 @@ impl<'sess> State<'sess, '_> {
870870 if !self . config . wrap_comments && cmnt. lines . len ( ) == 1 {
871871 self . word ( cmnt. lines . pop ( ) . unwrap ( ) ) ;
872872 } else if self . config . wrap_comments {
873- config. offset = self . ind ;
873+ if cmnt. is_doc || matches ! ( cmnt. kind, ast:: CommentKind :: Line ) {
874+ config. offset = 0 ;
875+ } else {
876+ config. offset = self . ind ;
877+ }
874878 for ( lpos, line) in cmnt. lines . into_iter ( ) . delimited ( ) {
875879 if !line. is_empty ( ) {
876- self . print_wrapped_line (
877- & line,
878- prefix,
879- if cmnt. is_doc { 0 } else { config. offset } ,
880- cmnt. is_doc ,
881- ) ;
880+ self . print_wrapped_line ( & line, prefix, config. offset , cmnt. is_doc ) ;
882881 }
883882 if !lpos. is_last {
884883 config. hardbreak ( & mut self . s ) ;
Original file line number Diff line number Diff line change 11contract SimpleComments {
2+ uint40 constant PERIOD = uint40 (12345 ); // ~578 days
3+ // Represents the depletion timestamp
4+ uint40 constant WARP_PERIOD = FEB_1_2025 + PERIOD;
5+
26 //´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:
37 // VARIABLES
48 //.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•
Original file line number Diff line number Diff line change 11contract SimpleComments {
2+ uint40 constant PERIOD = uint40 (12345 ); // ~578 days
3+ // Represents the depletion timestamp
4+ uint40 constant WARP_PERIOD = FEB_1_2025 + PERIOD;
5+
26 //´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:
37 // VARIABLES
48 //.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•
Original file line number Diff line number Diff line change 11// config: line_length = 60
22// config: wrap_comments = true
33contract SimpleComments {
4+ uint40 constant PERIOD = uint40 (12345 ); // ~578 days
5+ // Represents the depletion timestamp
6+ uint40 constant WARP_PERIOD = FEB_1_2025 + PERIOD;
7+
48 //´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:
59 // VARIABLES
610 //.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•
@@ -46,8 +50,8 @@ contract SimpleComments {
4650
4751 function test4 () public view returns (uint256 ) {
4852 uint256 abc; // long postfix comment that exceeds
49- // line width. the comment should be split and
50- // carried over to the next line
53+ // line width. the comment should be split and
54+ // carried over to the next line
5155 uint256 abc2; // reallylongsinglewordcommentthatexceedslinewidththecommentshouldbesplitandcarriedovertothenextline
5256
5357 // long prefix comment that exceeds line width. the
You can’t perform that action at this time.
0 commit comments