@@ -256,12 +256,12 @@ pub fn extract_decl(
256
256
row = Row :: new_zero_indexed ( row. 0 . saturating_add ( 1 ) ) ;
257
257
let mut line = line. trim ( ) ;
258
258
if let Some ( pos) = line. rfind ( '{' ) {
259
- line = & line[ 0 ..pos] . trim_right ( ) ;
259
+ line = & line[ 0 ..pos] . trim_end ( ) ;
260
260
lines. push ( line. into ( ) ) ;
261
261
break ;
262
262
} else if line. ends_with ( ';' ) {
263
263
let pos = line. len ( ) - 1 ;
264
- line = & line[ 0 ..pos] . trim_right ( ) ;
264
+ line = & line[ 0 ..pos] . trim_end ( ) ;
265
265
lines. push ( line. into ( ) ) ;
266
266
break ;
267
267
} else {
@@ -671,7 +671,7 @@ fn racer_match_to_def(ctx: &InitActionContext, m: &racer::Match) -> Option<Def>
671
671
. and_then ( |path| path. to_str ( ) . map ( |s| s. to_string ( ) ) )
672
672
. unwrap_or_else ( || contextstr. to_string ( ) )
673
673
} else {
674
- m. contextstr . trim_right_matches ( '{' ) . trim ( ) . to_string ( )
674
+ m. contextstr . trim_end_matches ( '{' ) . trim ( ) . to_string ( )
675
675
} ;
676
676
677
677
let filepath = m. filepath . clone ( ) ;
@@ -780,7 +780,7 @@ fn format_object(rustfmt: Rustfmt, fmt_config: &FmtConfig, the_type: String) ->
780
780
} else if trimmed. ends_with ( '}' ) || trimmed. ends_with ( ';' ) {
781
781
trimmed. to_string ( )
782
782
} else if trimmed. ends_with ( '{' ) {
783
- let trimmed = trimmed. trim_right_matches ( '{' ) . to_string ( ) ;
783
+ let trimmed = trimmed. trim_end_matches ( '{' ) . to_string ( ) ;
784
784
format ! ( "{}{{}}" , trimmed)
785
785
} else {
786
786
format ! ( "{}{{}}" , trimmed)
@@ -800,7 +800,7 @@ fn format_object(rustfmt: Rustfmt, fmt_config: &FmtConfig, the_type: String) ->
800
800
// If it's a tuple, remove the trailing ';' and hide non-pub components
801
801
// for pub types
802
802
let result = if formatted. trim ( ) . ends_with ( ';' ) {
803
- let mut decl = formatted. trim ( ) . trim_right_matches ( ';' ) ;
803
+ let mut decl = formatted. trim ( ) . trim_end_matches ( ';' ) ;
804
804
if let ( Some ( pos) , true ) = ( decl. rfind ( '(' ) , decl. ends_with ( ')' ) ) {
805
805
let mut hidden_count = 0 ;
806
806
let tuple_parts = decl[ pos + 1 ..decl. len ( ) - 1 ]
@@ -836,7 +836,7 @@ fn format_object(rustfmt: Rustfmt, fmt_config: &FmtConfig, the_type: String) ->
836
836
/// in the event of an error.
837
837
fn format_method ( rustfmt : Rustfmt , fmt_config : & FmtConfig , the_type : String ) -> String {
838
838
trace ! ( "format_method: {}" , the_type) ;
839
- let the_type = the_type. trim ( ) . trim_right_matches ( ';' ) . to_string ( ) ;
839
+ let the_type = the_type. trim ( ) . trim_end_matches ( ';' ) . to_string ( ) ;
840
840
841
841
let mut config = fmt_config. get_rustfmt_config ( ) . clone ( ) ;
842
842
config. set ( ) . newline_style ( NewlineStyle :: Unix ) ;
@@ -861,7 +861,7 @@ fn format_method(rustfmt: Rustfmt, fmt_config: &FmtConfig, the_type: String) ->
861
861
spaces = spaces. saturating_sub ( 1 ) ;
862
862
spaces > 0 && c. is_whitespace ( )
863
863
} ;
864
- let line = line. trim_left_matches ( should_trim) ;
864
+ let line = line. trim_start_matches ( should_trim) ;
865
865
format ! ( "{}\n " , line)
866
866
} ) . collect ( )
867
867
}
0 commit comments