mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 08:05:12 +00:00
Fix compiletest trim
deprecation warnings
This commit is contained in:
parent
748d354af3
commit
036ce5cdc4
@ -205,7 +205,7 @@ impl EarlyProps {
|
|||||||
fn ignore_lldb(config: &Config, line: &str) -> bool {
|
fn ignore_lldb(config: &Config, line: &str) -> bool {
|
||||||
if let Some(ref actual_version) = config.lldb_version {
|
if let Some(ref actual_version) = config.lldb_version {
|
||||||
if line.starts_with("min-lldb-version") {
|
if line.starts_with("min-lldb-version") {
|
||||||
let min_version = line.trim_right()
|
let min_version = line.trim_end()
|
||||||
.rsplit(' ')
|
.rsplit(' ')
|
||||||
.next()
|
.next()
|
||||||
.expect("Malformed lldb version directive");
|
.expect("Malformed lldb version directive");
|
||||||
@ -228,7 +228,7 @@ impl EarlyProps {
|
|||||||
}
|
}
|
||||||
if let Some(ref actual_version) = config.llvm_version {
|
if let Some(ref actual_version) = config.llvm_version {
|
||||||
if line.starts_with("min-llvm-version") {
|
if line.starts_with("min-llvm-version") {
|
||||||
let min_version = line.trim_right()
|
let min_version = line.trim_end()
|
||||||
.rsplit(' ')
|
.rsplit(' ')
|
||||||
.next()
|
.next()
|
||||||
.expect("Malformed llvm version directive");
|
.expect("Malformed llvm version directive");
|
||||||
@ -236,7 +236,7 @@ impl EarlyProps {
|
|||||||
// version
|
// version
|
||||||
&actual_version[..] < min_version
|
&actual_version[..] < min_version
|
||||||
} else if line.starts_with("min-system-llvm-version") {
|
} else if line.starts_with("min-system-llvm-version") {
|
||||||
let min_version = line.trim_right()
|
let min_version = line.trim_end()
|
||||||
.rsplit(' ')
|
.rsplit(' ')
|
||||||
.next()
|
.next()
|
||||||
.expect("Malformed llvm version directive");
|
.expect("Malformed llvm version directive");
|
||||||
@ -573,14 +573,14 @@ fn iter_header(testfile: &Path, cfg: Option<&str>, it: &mut dyn FnMut(&str)) {
|
|||||||
None => false,
|
None => false,
|
||||||
};
|
};
|
||||||
if matches {
|
if matches {
|
||||||
it(ln[(close_brace + 1)..].trim_left());
|
it(ln[(close_brace + 1)..].trim_start());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
panic!("malformed condition directive: expected `{}foo]`, found `{}`",
|
panic!("malformed condition directive: expected `{}foo]`, found `{}`",
|
||||||
comment_with_brace, ln)
|
comment_with_brace, ln)
|
||||||
}
|
}
|
||||||
} else if ln.starts_with(comment) {
|
} else if ln.starts_with(comment) {
|
||||||
it(ln[comment.len() ..].trim_left());
|
it(ln[comment.len() ..].trim_start());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -1079,7 +1079,7 @@ impl<'test> TestCx<'test> {
|
|||||||
match line {
|
match line {
|
||||||
Ok(line) => {
|
Ok(line) => {
|
||||||
let line = if line.starts_with("//") {
|
let line = if line.starts_with("//") {
|
||||||
line[2..].trim_left()
|
line[2..].trim_start()
|
||||||
} else {
|
} else {
|
||||||
line.as_str()
|
line.as_str()
|
||||||
};
|
};
|
||||||
@ -2143,8 +2143,8 @@ impl<'test> TestCx<'test> {
|
|||||||
.lines()
|
.lines()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter_map(|(line_nb, line)| {
|
.filter_map(|(line_nb, line)| {
|
||||||
if (line.trim_left().starts_with("pub mod ")
|
if (line.trim_start().starts_with("pub mod ")
|
||||||
|| line.trim_left().starts_with("mod "))
|
|| line.trim_start().starts_with("mod "))
|
||||||
&& line.ends_with(';')
|
&& line.ends_with(';')
|
||||||
{
|
{
|
||||||
if let Some(ref mut other_files) = other_files {
|
if let Some(ref mut other_files) = other_files {
|
||||||
@ -2153,7 +2153,7 @@ impl<'test> TestCx<'test> {
|
|||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
let sline = line.split("///").last().unwrap_or("");
|
let sline = line.split("///").last().unwrap_or("");
|
||||||
let line = sline.trim_left();
|
let line = sline.trim_start();
|
||||||
if line.starts_with("```") {
|
if line.starts_with("```") {
|
||||||
if ignore {
|
if ignore {
|
||||||
ignore = false;
|
ignore = false;
|
||||||
@ -3284,7 +3284,7 @@ fn normalize_mir_line(line: &str) -> String {
|
|||||||
fn nocomment_mir_line(line: &str) -> &str {
|
fn nocomment_mir_line(line: &str) -> &str {
|
||||||
if let Some(idx) = line.find("//") {
|
if let Some(idx) = line.find("//") {
|
||||||
let (l, _) = line.split_at(idx);
|
let (l, _) = line.split_at(idx);
|
||||||
l.trim_right()
|
l.trim_end()
|
||||||
} else {
|
} else {
|
||||||
line
|
line
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user