Skip to content

Commit 6e4d64a

Browse files
committed
Auto merge of rust-lang#3549 - flip1995:rustup, r=oli-obk
rustup rust-lang#52994 `trim_left*` and `trim_right*` are deprecated as of 1.33.0. `s/trim_left/trim_start/` `s/trim_right/trim_end/`
2 parents 17a9aff + d866f31 commit 6e4d64a

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

clippy_lints/src/collapsible_if.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ fn check_if(cx: &EarlyContext<'_>, expr: &ast::Expr) {
116116
fn block_starts_with_comment(cx: &EarlyContext<'_>, expr: &ast::Block) -> bool {
117117
// We trim all opening braces and whitespaces and then check if the next string is a comment.
118118
let trimmed_block_text = snippet_block(cx, expr.span, "..")
119-
.trim_left_matches(|c: char| c.is_whitespace() || c == '{')
119+
.trim_start_matches(|c: char| c.is_whitespace() || c == '{')
120120
.to_owned();
121121
trimmed_block_text.starts_with("//") || trimmed_block_text.starts_with("/*")
122122
}

clippy_lints/src/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub fn strip_doc_comment_decoration(comment: &str, span: Span) -> (String, Vec<(
116116
for line in doc.lines() {
117117
let offset = line.as_ptr() as usize - comment.as_ptr() as usize;
118118
debug_assert_eq!(offset as u32 as usize, offset);
119-
contains_initial_stars |= line.trim_left().starts_with('*');
119+
contains_initial_stars |= line.trim_start().starts_with('*');
120120
// +1 for the newline
121121
sizes.push((line.len() + 1, span.with_lo(span.lo() + BytePos(offset as u32))));
122122
}

clippy_lints/src/methods/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2350,8 +2350,8 @@ const PATTERN_METHODS: [(&str, usize); 17] = [
23502350
("rmatches", 1),
23512351
("match_indices", 1),
23522352
("rmatch_indices", 1),
2353-
("trim_left_matches", 1),
2354-
("trim_right_matches", 1),
2353+
("trim_start_matches", 1),
2354+
("trim_end_matches", 1),
23552355
];
23562356

23572357
#[derive(Clone, Copy, PartialEq, Debug)]

clippy_lints/src/misc_early.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -446,13 +446,13 @@ impl MiscEarly {
446446
db.span_suggestion_with_applicability(
447447
lit.span,
448448
"if you mean to use a decimal constant, remove the `0` to remove confusion",
449-
src.trim_left_matches(|c| c == '_' || c == '0').to_string(),
449+
src.trim_start_matches(|c| c == '_' || c == '0').to_string(),
450450
Applicability::MaybeIncorrect,
451451
);
452452
db.span_suggestion_with_applicability(
453453
lit.span,
454454
"if you mean to use an octal constant, use `0o`",
455-
format!("0o{}", src.trim_left_matches(|c| c == '_' || c == '0')),
455+
format!("0o{}", src.trim_start_matches(|c| c == '_' || c == '0')),
456456
Applicability::MaybeIncorrect,
457457
);
458458
});

tests/ui/single_char_pattern.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ fn main() {
4242
x.rmatches("x");
4343
x.match_indices("x");
4444
x.rmatch_indices("x");
45-
x.trim_left_matches("x");
46-
x.trim_right_matches("x");
45+
x.trim_start_matches("x");
46+
x.trim_end_matches("x");
4747
// Make sure we escape characters correctly.
4848
x.split("\n");
4949

tests/ui/single_char_pattern.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,16 @@ error: single-character string constant used as pattern
9191
| ^^^ help: try using a char instead: `'x'`
9292

9393
error: single-character string constant used as pattern
94-
--> $DIR/single_char_pattern.rs:45:25
94+
--> $DIR/single_char_pattern.rs:45:26
9595
|
96-
45 | x.trim_left_matches("x");
97-
| ^^^ help: try using a char instead: `'x'`
96+
45 | x.trim_start_matches("x");
97+
| ^^^ help: try using a char instead: `'x'`
9898

9999
error: single-character string constant used as pattern
100-
--> $DIR/single_char_pattern.rs:46:26
100+
--> $DIR/single_char_pattern.rs:46:24
101101
|
102-
46 | x.trim_right_matches("x");
103-
| ^^^ help: try using a char instead: `'x'`
102+
46 | x.trim_end_matches("x");
103+
| ^^^ help: try using a char instead: `'x'`
104104

105105
error: single-character string constant used as pattern
106106
--> $DIR/single_char_pattern.rs:48:13

0 commit comments

Comments
 (0)