Skip to content

Commit 0880d95

Browse files
committed
Rollup merge of #56989 - phansch:fix_compiletest_trim_deprecations, r=Mark-Simulacrum
Fix compiletest `trim` deprecation warnings None
2 parents b2207e2 + 036ce5c commit 0880d95

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/tools/compiletest/src/header.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ impl EarlyProps {
205205
fn ignore_lldb(config: &Config, line: &str) -> bool {
206206
if let Some(ref actual_version) = config.lldb_version {
207207
if line.starts_with("min-lldb-version") {
208-
let min_version = line.trim_right()
208+
let min_version = line.trim_end()
209209
.rsplit(' ')
210210
.next()
211211
.expect("Malformed lldb version directive");
@@ -228,15 +228,15 @@ impl EarlyProps {
228228
}
229229
if let Some(ref actual_version) = config.llvm_version {
230230
if line.starts_with("min-llvm-version") {
231-
let min_version = line.trim_right()
231+
let min_version = line.trim_end()
232232
.rsplit(' ')
233233
.next()
234234
.expect("Malformed llvm version directive");
235235
// Ignore if actual version is smaller the minimum required
236236
// version
237237
&actual_version[..] < min_version
238238
} else if line.starts_with("min-system-llvm-version") {
239-
let min_version = line.trim_right()
239+
let min_version = line.trim_end()
240240
.rsplit(' ')
241241
.next()
242242
.expect("Malformed llvm version directive");
@@ -573,14 +573,14 @@ fn iter_header(testfile: &Path, cfg: Option<&str>, it: &mut dyn FnMut(&str)) {
573573
None => false,
574574
};
575575
if matches {
576-
it(ln[(close_brace + 1)..].trim_left());
576+
it(ln[(close_brace + 1)..].trim_start());
577577
}
578578
} else {
579579
panic!("malformed condition directive: expected `{}foo]`, found `{}`",
580580
comment_with_brace, ln)
581581
}
582582
} else if ln.starts_with(comment) {
583-
it(ln[comment.len() ..].trim_left());
583+
it(ln[comment.len() ..].trim_start());
584584
}
585585
}
586586
return;

src/tools/compiletest/src/runtest.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ impl<'test> TestCx<'test> {
10821082
match line {
10831083
Ok(line) => {
10841084
let line = if line.starts_with("//") {
1085-
line[2..].trim_left()
1085+
line[2..].trim_start()
10861086
} else {
10871087
line.as_str()
10881088
};
@@ -2146,8 +2146,8 @@ impl<'test> TestCx<'test> {
21462146
.lines()
21472147
.enumerate()
21482148
.filter_map(|(line_nb, line)| {
2149-
if (line.trim_left().starts_with("pub mod ")
2150-
|| line.trim_left().starts_with("mod "))
2149+
if (line.trim_start().starts_with("pub mod ")
2150+
|| line.trim_start().starts_with("mod "))
21512151
&& line.ends_with(';')
21522152
{
21532153
if let Some(ref mut other_files) = other_files {
@@ -2156,7 +2156,7 @@ impl<'test> TestCx<'test> {
21562156
None
21572157
} else {
21582158
let sline = line.split("///").last().unwrap_or("");
2159-
let line = sline.trim_left();
2159+
let line = sline.trim_start();
21602160
if line.starts_with("```") {
21612161
if ignore {
21622162
ignore = false;
@@ -3287,7 +3287,7 @@ fn normalize_mir_line(line: &str) -> String {
32873287
fn nocomment_mir_line(line: &str) -> &str {
32883288
if let Some(idx) = line.find("//") {
32893289
let (l, _) = line.split_at(idx);
3290-
l.trim_right()
3290+
l.trim_end()
32913291
} else {
32923292
line
32933293
}

0 commit comments

Comments
 (0)