@@ -32,9 +32,9 @@ use patterns::{can_be_overflowed_pat, TuplePatField};
32
32
use rewrite:: { Rewrite , RewriteContext } ;
33
33
use string:: { rewrite_string, StringFormat } ;
34
34
use types:: { can_be_overflowed_type, rewrite_path, PathContext } ;
35
- use utils:: { binary_search , colon_spaces, contains_skip, extra_offset, first_line_width,
36
- inner_attributes , last_line_extendable, last_line_width, left_most_sub_expr, mk_sp,
37
- outer_attributes , paren_overhead, ptr_vec_to_ref_vec, semicolon_for_stmt, stmt_expr,
35
+ use utils:: { colon_spaces, contains_skip, extra_offset, first_line_width, inner_attributes ,
36
+ last_line_extendable, last_line_width, left_most_sub_expr, mk_sp, outer_attributes ,
37
+ paren_overhead, ptr_vec_to_ref_vec, semicolon_for_stmt, stmt_expr,
38
38
trimmed_last_line_width, wrap_str} ;
39
39
use vertical:: rewrite_with_alignment;
40
40
use visitor:: FmtVisitor ;
@@ -83,13 +83,8 @@ pub fn format_expr(
83
83
} ,
84
84
ast:: ExprKind :: Call ( ref callee, ref args) => {
85
85
let inner_span = mk_sp ( callee. span . hi ( ) , expr. span . hi ( ) ) ;
86
- rewrite_call_with_binary_search (
87
- context,
88
- & * * callee,
89
- & ptr_vec_to_ref_vec ( & args) ,
90
- inner_span,
91
- shape,
92
- )
86
+ let callee_str = try_opt ! ( callee. rewrite( context, shape) ) ;
87
+ rewrite_call ( context, & callee_str, & args, inner_span, shape)
93
88
}
94
89
ast:: ExprKind :: Paren ( ref subexpr) => rewrite_paren ( context, subexpr, shape) ,
95
90
ast:: ExprKind :: Binary ( ref op, ref lhs, ref rhs) => {
@@ -2036,46 +2031,6 @@ fn string_requires_rewrite(
2036
2031
false
2037
2032
}
2038
2033
2039
- pub fn rewrite_call_with_binary_search < R > (
2040
- context : & RewriteContext ,
2041
- callee : & R ,
2042
- args : & [ & ast:: Expr ] ,
2043
- span : Span ,
2044
- shape : Shape ,
2045
- ) -> Option < String >
2046
- where
2047
- R : Rewrite ,
2048
- {
2049
- let force_trailing_comma = if context. inside_macro {
2050
- span_ends_with_comma ( context, span)
2051
- } else {
2052
- false
2053
- } ;
2054
- let closure = |callee_max_width| {
2055
- // FIXME using byte lens instead of char lens (and probably all over the
2056
- // place too)
2057
- let callee_shape = Shape {
2058
- width : callee_max_width,
2059
- ..shape
2060
- } ;
2061
- let callee_str = callee
2062
- . rewrite ( context, callee_shape)
2063
- . ok_or ( Ordering :: Greater ) ?;
2064
-
2065
- rewrite_call_inner (
2066
- context,
2067
- & callee_str,
2068
- args,
2069
- span,
2070
- shape,
2071
- context. config . fn_call_width ( ) ,
2072
- force_trailing_comma,
2073
- )
2074
- } ;
2075
-
2076
- binary_search ( 1 , shape. width , closure)
2077
- }
2078
-
2079
2034
pub fn rewrite_call (
2080
2035
context : & RewriteContext ,
2081
2036
callee : & str ,
0 commit comments