Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 8c33155

Browse files
authored
Merge pull request #1203 from Xanewok/fix-deprecated-warnings
Fix deprecated `trim_{left,right}` warnings
2 parents 173be77 + bacdd97 commit 8c33155

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/actions/hover.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,12 @@ pub fn extract_decl(
256256
row = Row::new_zero_indexed(row.0.saturating_add(1));
257257
let mut line = line.trim();
258258
if let Some(pos) = line.rfind('{') {
259-
line = &line[0..pos].trim_right();
259+
line = &line[0..pos].trim_end();
260260
lines.push(line.into());
261261
break;
262262
} else if line.ends_with(';') {
263263
let pos = line.len() - 1;
264-
line = &line[0..pos].trim_right();
264+
line = &line[0..pos].trim_end();
265265
lines.push(line.into());
266266
break;
267267
} else {
@@ -671,7 +671,7 @@ fn racer_match_to_def(ctx: &InitActionContext, m: &racer::Match) -> Option<Def>
671671
.and_then(|path| path.to_str().map(|s| s.to_string()))
672672
.unwrap_or_else(|| contextstr.to_string())
673673
} else {
674-
m.contextstr.trim_right_matches('{').trim().to_string()
674+
m.contextstr.trim_end_matches('{').trim().to_string()
675675
};
676676

677677
let filepath = m.filepath.clone();
@@ -780,7 +780,7 @@ fn format_object(rustfmt: Rustfmt, fmt_config: &FmtConfig, the_type: String) ->
780780
} else if trimmed.ends_with('}') || trimmed.ends_with(';') {
781781
trimmed.to_string()
782782
} else if trimmed.ends_with('{') {
783-
let trimmed = trimmed.trim_right_matches('{').to_string();
783+
let trimmed = trimmed.trim_end_matches('{').to_string();
784784
format!("{}{{}}", trimmed)
785785
} else {
786786
format!("{}{{}}", trimmed)
@@ -800,7 +800,7 @@ fn format_object(rustfmt: Rustfmt, fmt_config: &FmtConfig, the_type: String) ->
800800
// If it's a tuple, remove the trailing ';' and hide non-pub components
801801
// for pub types
802802
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(';');
804804
if let (Some(pos), true) = (decl.rfind('('), decl.ends_with(')')) {
805805
let mut hidden_count = 0;
806806
let tuple_parts = decl[pos + 1..decl.len() - 1]
@@ -836,7 +836,7 @@ fn format_object(rustfmt: Rustfmt, fmt_config: &FmtConfig, the_type: String) ->
836836
/// in the event of an error.
837837
fn format_method(rustfmt: Rustfmt, fmt_config: &FmtConfig, the_type: String) -> String {
838838
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();
840840

841841
let mut config = fmt_config.get_rustfmt_config().clone();
842842
config.set().newline_style(NewlineStyle::Unix);
@@ -861,7 +861,7 @@ fn format_method(rustfmt: Rustfmt, fmt_config: &FmtConfig, the_type: String) ->
861861
spaces = spaces.saturating_sub(1);
862862
spaces > 0 && c.is_whitespace()
863863
};
864-
let line = line.trim_left_matches(should_trim);
864+
let line = line.trim_start_matches(should_trim);
865865
format!("{}\n", line)
866866
}).collect()
867867
}

0 commit comments

Comments
 (0)