File tree 3 files changed +12
-13
lines changed
3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ fn format_derive(
187
187
} else if let SeparatorTactic :: Always = context. config . trailing_comma ( ) {
188
188
// Retain the trailing comma.
189
189
result. push_str ( & item_str) ;
190
- } else if item_str. ends_with ( "," ) {
190
+ } else if item_str. ends_with ( ',' ) {
191
191
// Remove the trailing comma.
192
192
result. push_str ( & item_str[ ..item_str. len ( ) - 1 ] ) ;
193
193
} else {
Original file line number Diff line number Diff line change @@ -1704,8 +1704,8 @@ impl<'a> Iterator for CommentReducer<'a> {
1704
1704
fn remove_comment_header ( comment : & str ) -> & str {
1705
1705
if comment. starts_with ( "///" ) || comment. starts_with ( "//!" ) {
1706
1706
& comment[ 3 ..]
1707
- } else if comment. starts_with ( "//" ) {
1708
- & comment [ 2 .. ]
1707
+ } else if let Some ( stripped ) = comment. strip_prefix ( "//" ) {
1708
+ & stripped
1709
1709
} else if ( comment. starts_with ( "/**" ) && !comment. starts_with ( "/**/" ) )
1710
1710
|| comment. starts_with ( "/*!" )
1711
1711
{
Original file line number Diff line number Diff line change @@ -50,16 +50,15 @@ impl AlignedItem for ast::StructField {
50
50
mk_sp ( self . attrs . last ( ) . unwrap ( ) . span . hi ( ) , self . span . lo ( ) )
51
51
} ;
52
52
let attrs_extendable = self . ident . is_none ( ) && is_attributes_extendable ( & attrs_str) ;
53
- Some ( rewrite_struct_field_prefix ( context, self ) ) . and_then ( |field_str| {
54
- combine_strs_with_missing_comments (
55
- context,
56
- & attrs_str,
57
- & field_str,
58
- missing_span,
59
- shape,
60
- attrs_extendable,
61
- )
62
- } )
53
+ let prefix = rewrite_struct_field_prefix ( context, self ) ;
54
+ combine_strs_with_missing_comments (
55
+ context,
56
+ & attrs_str,
57
+ & prefix,
58
+ missing_span,
59
+ shape,
60
+ attrs_extendable,
61
+ )
63
62
}
64
63
65
64
fn rewrite_aligned_item (
You can’t perform that action at this time.
0 commit comments