File tree Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ fn format_derive(
187187 } else if let SeparatorTactic :: Always = context. config . trailing_comma ( ) {
188188 // Retain the trailing comma.
189189 result. push_str ( & item_str) ;
190- } else if item_str. ends_with ( "," ) {
190+ } else if item_str. ends_with ( ',' ) {
191191 // Remove the trailing comma.
192192 result. push_str ( & item_str[ ..item_str. len ( ) - 1 ] ) ;
193193 } else {
Original file line number Diff line number Diff line change @@ -1704,8 +1704,8 @@ impl<'a> Iterator for CommentReducer<'a> {
17041704fn remove_comment_header ( comment : & str ) -> & str {
17051705 if comment. starts_with ( "///" ) || comment. starts_with ( "//!" ) {
17061706 & comment[ 3 ..]
1707- } else if comment. starts_with ( "//" ) {
1708- & comment [ 2 .. ]
1707+ } else if let Some ( stripped ) = comment. strip_prefix ( "//" ) {
1708+ & stripped
17091709 } else if ( comment. starts_with ( "/**" ) && !comment. starts_with ( "/**/" ) )
17101710 || comment. starts_with ( "/*!" )
17111711 {
Original file line number Diff line number Diff line change @@ -50,16 +50,15 @@ impl AlignedItem for ast::StructField {
5050 mk_sp ( self . attrs . last ( ) . unwrap ( ) . span . hi ( ) , self . span . lo ( ) )
5151 } ;
5252 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+ )
6362 }
6463
6564 fn rewrite_aligned_item (
You can’t perform that action at this time.
0 commit comments