@@ -834,7 +834,7 @@ pub(crate) fn format_impl(
834
834
// there is only one where-clause predicate
835
835
// recover the suppressed comma in single line where_clause formatting
836
836
if generics. where_clause . predicates . len ( ) == 1 {
837
- result. push_str ( "," ) ;
837
+ result. push ( ',' ) ;
838
838
}
839
839
result. push_str ( & format ! ( "{}{{{}}}" , sep, sep) ) ;
840
840
} else {
@@ -1737,18 +1737,18 @@ fn type_annotation_spacing(config: &Config) -> (&str, &str) {
1737
1737
pub ( crate ) fn rewrite_struct_field_prefix (
1738
1738
context : & RewriteContext < ' _ > ,
1739
1739
field : & ast:: StructField ,
1740
- ) -> Option < String > {
1740
+ ) -> String {
1741
1741
let vis = format_visibility ( context, & field. vis ) ;
1742
1742
let type_annotation_spacing = type_annotation_spacing ( context. config ) ;
1743
- Some ( match field. ident {
1743
+ match field. ident {
1744
1744
Some ( name) => format ! (
1745
1745
"{}{}{}:" ,
1746
1746
vis,
1747
1747
rewrite_ident( context, name) ,
1748
1748
type_annotation_spacing. 0
1749
1749
) ,
1750
1750
None => vis. to_string ( ) ,
1751
- } )
1751
+ }
1752
1752
}
1753
1753
1754
1754
impl Rewrite for ast:: StructField {
@@ -1768,7 +1768,7 @@ pub(crate) fn rewrite_struct_field(
1768
1768
}
1769
1769
1770
1770
let type_annotation_spacing = type_annotation_spacing ( context. config ) ;
1771
- let prefix = rewrite_struct_field_prefix ( context, field) ? ;
1771
+ let prefix = rewrite_struct_field_prefix ( context, field) ;
1772
1772
1773
1773
let attrs_str = field. attrs . rewrite ( context, shape) ?;
1774
1774
let attrs_extendable = field. ident . is_none ( ) && is_attributes_extendable ( & attrs_str) ;
@@ -1945,7 +1945,7 @@ fn rewrite_static(
1945
1945
comments_span,
1946
1946
true ,
1947
1947
)
1948
- . and_then ( |res| recover_comment_removed ( res, static_parts. span , context) )
1948
+ . map ( |res| recover_comment_removed ( res, static_parts. span , context) )
1949
1949
. or_else ( || {
1950
1950
let nested_indent = offset. block_indent ( context. config ) ;
1951
1951
let ty_span_hi = static_parts. ty . span . hi ( ) ;
@@ -2357,7 +2357,7 @@ fn rewrite_fn_base(
2357
2357
ret_str_len,
2358
2358
fn_brace_style,
2359
2359
multi_line_ret_str,
2360
- ) ? ;
2360
+ ) ;
2361
2361
2362
2362
debug ! (
2363
2363
"rewrite_fn_base: one_line_budget: {}, multi_line_budget: {}, param_indent: {:?}" ,
@@ -2744,7 +2744,7 @@ fn compute_budgets_for_params(
2744
2744
ret_str_len : usize ,
2745
2745
fn_brace_style : FnBraceStyle ,
2746
2746
force_vertical_layout : bool ,
2747
- ) -> Option < ( usize , usize , Indent ) > {
2747
+ ) -> ( usize , usize , Indent ) {
2748
2748
debug ! (
2749
2749
"compute_budgets_for_params {} {:?}, {}, {:?}" ,
2750
2750
result. len( ) ,
@@ -2781,7 +2781,7 @@ fn compute_budgets_for_params(
2781
2781
}
2782
2782
} ;
2783
2783
2784
- return Some ( ( one_line_budget, multi_line_budget, indent) ) ;
2784
+ return ( one_line_budget, multi_line_budget, indent) ;
2785
2785
}
2786
2786
}
2787
2787
@@ -2793,7 +2793,7 @@ fn compute_budgets_for_params(
2793
2793
// Account for `)` and possibly ` {`.
2794
2794
IndentStyle :: Visual => new_indent. width ( ) + if ret_str_len == 0 { 1 } else { 3 } ,
2795
2795
} ;
2796
- Some ( ( 0 , context. budget ( used_space) , new_indent) )
2796
+ ( 0 , context. budget ( used_space) , new_indent)
2797
2797
}
2798
2798
2799
2799
fn newline_for_brace ( config : & Config , where_clause : & ast:: WhereClause ) -> FnBraceStyle {
0 commit comments