Skip to content

Commit 9026467

Browse files
committed
---
yaml --- r: 233919 b: refs/heads/beta c: 3a360fc h: refs/heads/master i: 233917: 154ae9e 233915: 52d40f7 233911: 09e1b9f 233903: b15069d 233887: c940e57 233855: 7b6a6a0 v: v3
1 parent e6271b4 commit 9026467

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1220
-8913
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: cfd76b364cd01695517467299618ef63f1c0cc07
26+
refs/heads/beta: 3a360fca78b415d31783ec715a2c9024a89eeb75
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/compiletest/compiletest.rs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pub fn log_config(config: &Config) {
178178
logv(c, format!("filter: {}",
179179
opt_str(&config.filter
180180
.as_ref()
181-
.map(|re| re.to_owned()))));
181+
.map(|re| re.to_string()))));
182182
logv(c, format!("runtool: {}", opt_str(&config.runtool)));
183183
logv(c, format!("host-rustcflags: {}",
184184
opt_str(&config.host_rustcflags)));
@@ -205,16 +205,19 @@ pub fn opt_str<'a>(maybestr: &'a Option<String>) -> &'a str {
205205

206206
pub fn opt_str2(maybestr: Option<String>) -> String {
207207
match maybestr {
208-
None => "(none)".to_owned(),
208+
None => "(none)".to_string(),
209209
Some(s) => s,
210210
}
211211
}
212212

213213
pub fn run_tests(config: &Config) {
214214
if config.target.contains("android") {
215-
if let DebugInfoGdb = config.mode {
216-
println!("{} debug-info test uses tcp 5039 port.\
217-
please reserve it", config.target);
215+
match config.mode {
216+
DebugInfoGdb => {
217+
println!("{} debug-info test uses tcp 5039 port.\
218+
please reserve it", config.target);
219+
}
220+
_ =>{}
218221
}
219222

220223
// android debug-info test uses remote debugger
@@ -286,10 +289,10 @@ pub fn is_test(config: &Config, testfile: &Path) -> bool {
286289
// Pretty-printer does not work with .rc files yet
287290
let valid_extensions =
288291
match config.mode {
289-
Pretty => vec!(".rs".to_owned()),
290-
_ => vec!(".rc".to_owned(), ".rs".to_owned())
292+
Pretty => vec!(".rs".to_string()),
293+
_ => vec!(".rc".to_string(), ".rs".to_string())
291294
};
292-
let invalid_prefixes = vec!(".".to_owned(), "#".to_owned(), "~".to_owned());
295+
let invalid_prefixes = vec!(".".to_string(), "#".to_string(), "~".to_string());
293296
let name = testfile.file_name().unwrap().to_str().unwrap();
294297

295298
let mut valid = false;
@@ -361,7 +364,7 @@ fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
361364
full_version_line.char_at(pos + 3).is_digit(10) {
362365
continue
363366
}
364-
return Some(full_version_line[pos..pos+3].to_owned());
367+
return Some(full_version_line[pos..pos+3].to_string());
365368
}
366369
println!("Could not extract GDB version from line '{}'",
367370
full_version_line);
@@ -383,8 +386,9 @@ fn extract_lldb_version(full_version_line: Option<String>) -> Option<String> {
383386
// We are only interested in the major version number, so this function
384387
// will return `Some("179")` and `Some("300")` respectively.
385388

386-
if let Some(ref full_version_line) = full_version_line {
387-
if !full_version_line.trim().is_empty() {
389+
match full_version_line {
390+
Some(ref full_version_line)
391+
if !full_version_line.trim().is_empty() => {
388392
let full_version_line = full_version_line.trim();
389393

390394
for (pos, l) in full_version_line.char_indices() {
@@ -406,7 +410,8 @@ fn extract_lldb_version(full_version_line: Option<String>) -> Option<String> {
406410
}
407411
println!("Could not extract LLDB version from line '{}'",
408412
full_version_line);
409-
}
413+
None
414+
},
415+
_ => None
410416
}
411-
None
412417
}

branches/beta/src/compiletest/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ fn parse_expected(last_nonfollow_error: Option<usize>,
7676
let letters = line[kind_start..].chars();
7777
let msg = letters.skip_while(|c| c.is_whitespace())
7878
.skip_while(|c| !c.is_whitespace())
79-
.collect::<String>().trim().to_owned();
79+
.collect::<String>().trim().to_string();
8080

8181
let (which, line) = if follow {
8282
assert!(adjusts == 0, "use either //~| or //~^, not both.");

branches/beta/src/compiletest/header.rs

Lines changed: 65 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ pub fn load_props(testfile: &Path) -> TestProps {
6767
let mut pretty_compare_only = false;
6868
let mut forbid_output = Vec::new();
6969
iter_header(testfile, &mut |ln| {
70-
if let Some(ep) = parse_error_pattern(ln) {
71-
error_patterns.push(ep);
72-
}
70+
match parse_error_pattern(ln) {
71+
Some(ep) => error_patterns.push(ep),
72+
None => ()
73+
};
7374

7475
if compile_flags.is_none() {
7576
compile_flags = parse_compile_flags(ln);
@@ -107,20 +108,24 @@ pub fn load_props(testfile: &Path) -> TestProps {
107108
pretty_compare_only = parse_pretty_compare_only(ln);
108109
}
109110

110-
if let Some(ab) = parse_aux_build(ln) {
111-
aux_builds.push(ab);
111+
match parse_aux_build(ln) {
112+
Some(ab) => { aux_builds.push(ab); }
113+
None => {}
112114
}
113115

114-
if let Some(ee) = parse_exec_env(ln) {
115-
exec_env.push(ee);
116+
match parse_exec_env(ln) {
117+
Some(ee) => { exec_env.push(ee); }
118+
None => {}
116119
}
117120

118-
if let Some(cl) = parse_check_line(ln) {
119-
check_lines.push(cl);
120-
}
121+
match parse_check_line(ln) {
122+
Some(cl) => check_lines.push(cl),
123+
None => ()
124+
};
121125

122-
if let Some(of) = parse_forbid_output(ln) {
123-
forbid_output.push(of);
126+
match parse_forbid_output(ln) {
127+
Some(of) => forbid_output.push(of),
128+
None => (),
124129
}
125130

126131
true
@@ -129,8 +134,8 @@ pub fn load_props(testfile: &Path) -> TestProps {
129134
for key in vec!["RUST_TEST_NOCAPTURE", "RUST_TEST_THREADS"] {
130135
match env::var(key) {
131136
Ok(val) =>
132-
if exec_env.iter().find(|&&(ref x, _)| *x == key).is_none() {
133-
exec_env.push((key.to_owned(), val))
137+
if exec_env.iter().find(|&&(ref x, _)| *x == key.to_string()).is_none() {
138+
exec_env.push((key.to_string(), val))
134139
},
135140
Err(..) => {}
136141
}
@@ -148,7 +153,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
148153
check_stdout: check_stdout,
149154
no_prefer_dynamic: no_prefer_dynamic,
150155
pretty_expanded: pretty_expanded,
151-
pretty_mode: pretty_mode.unwrap_or("normal".to_owned()),
156+
pretty_mode: pretty_mode.unwrap_or("normal".to_string()),
152157
pretty_compare_only: pretty_compare_only,
153158
forbid_output: forbid_output,
154159
}
@@ -177,21 +182,22 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
177182
return true;
178183
}
179184

180-
if let Some(ref actual_version) = config.gdb_version {
181-
if line.contains("min-gdb-version") {
182-
let min_version = line.trim()
183-
.split(' ')
184-
.last()
185-
.expect("Malformed GDB version directive");
186-
// Ignore if actual version is smaller the minimum required
187-
// version
188-
gdb_version_to_int(actual_version) <
189-
gdb_version_to_int(min_version)
190-
} else {
191-
false
185+
match config.gdb_version {
186+
Some(ref actual_version) => {
187+
if line.contains("min-gdb-version") {
188+
let min_version = line.trim()
189+
.split(' ')
190+
.last()
191+
.expect("Malformed GDB version directive");
192+
// Ignore if actual version is smaller the minimum required
193+
// version
194+
gdb_version_to_int(actual_version) <
195+
gdb_version_to_int(min_version)
196+
} else {
197+
false
198+
}
192199
}
193-
} else {
194-
false
200+
None => false
195201
}
196202
}
197203

@@ -204,21 +210,22 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
204210
return true;
205211
}
206212

207-
if let Some(ref actual_version) = config.lldb_version {
208-
if line.contains("min-lldb-version") {
209-
let min_version = line.trim()
210-
.split(' ')
211-
.last()
212-
.expect("Malformed lldb version directive");
213-
// Ignore if actual version is smaller the minimum required
214-
// version
215-
lldb_version_to_int(actual_version) <
216-
lldb_version_to_int(min_version)
217-
} else {
218-
false
213+
match config.lldb_version {
214+
Some(ref actual_version) => {
215+
if line.contains("min-lldb-version") {
216+
let min_version = line.trim()
217+
.split(' ')
218+
.last()
219+
.expect("Malformed lldb version directive");
220+
// Ignore if actual version is smaller the minimum required
221+
// version
222+
lldb_version_to_int(actual_version) <
223+
lldb_version_to_int(min_version)
224+
} else {
225+
false
226+
}
219227
}
220-
} else {
221-
false
228+
None => false
222229
}
223230
}
224231

@@ -309,11 +316,11 @@ fn parse_exec_env(line: &str) -> Option<(String, String)> {
309316
// nv is either FOO or FOO=BAR
310317
let mut strs: Vec<String> = nv
311318
.splitn(2, '=')
312-
.map(str::to_owned)
319+
.map(|s| s.to_string())
313320
.collect();
314321

315322
match strs.len() {
316-
1 => (strs.pop().unwrap(), "".to_owned()),
323+
1 => (strs.pop().unwrap(), "".to_string()),
317324
2 => {
318325
let end = strs.pop().unwrap();
319326
(strs.pop().unwrap(), end)
@@ -324,31 +331,33 @@ fn parse_exec_env(line: &str) -> Option<(String, String)> {
324331
}
325332

326333
fn parse_pp_exact(line: &str, testfile: &Path) -> Option<PathBuf> {
327-
if let Some(s) = parse_name_value_directive(line, "pp-exact") {
328-
Some(PathBuf::from(&s))
329-
} else {
334+
match parse_name_value_directive(line, "pp-exact") {
335+
Some(s) => Some(PathBuf::from(&s)),
336+
None => {
330337
if parse_name_directive(line, "pp-exact") {
331-
testfile.file_name().map(PathBuf::from)
338+
testfile.file_name().map(|s| PathBuf::from(s))
332339
} else {
333340
None
334341
}
342+
}
335343
}
336344
}
337345

338346
fn parse_name_directive(line: &str, directive: &str) -> bool {
339347
// This 'no-' rule is a quick hack to allow pretty-expanded and no-pretty-expanded to coexist
340-
line.contains(directive) && !line.contains(&("no-".to_owned() + directive))
348+
line.contains(directive) && !line.contains(&("no-".to_string() + directive))
341349
}
342350

343351
pub fn parse_name_value_directive(line: &str, directive: &str)
344352
-> Option<String> {
345353
let keycolon = format!("{}:", directive);
346-
if let Some(colon) = line.find(&keycolon) {
347-
let value = line[(colon + keycolon.len()) .. line.len()].to_owned();
348-
debug!("{}: {}", directive, value);
349-
Some(value)
350-
} else {
351-
None
354+
match line.find(&keycolon) {
355+
Some(colon) => {
356+
let value = line[(colon + keycolon.len()) .. line.len()].to_string();
357+
debug!("{}: {}", directive, value);
358+
Some(value)
359+
}
360+
None => None
352361
}
353362
}
354363

branches/beta/src/compiletest/procsrv.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ fn add_target_env(cmd: &mut Command, lib_path: &str, aux_path: Option<&str>) {
1717
// Need to be sure to put both the lib_path and the aux path in the dylib
1818
// search path for the child.
1919
let mut path = DynamicLibrary::search_path();
20-
if let Some(p) = aux_path {
21-
path.insert(0, PathBuf::from(p))
20+
match aux_path {
21+
Some(p) => path.insert(0, PathBuf::from(p)),
22+
None => {}
2223
}
2324
path.insert(0, PathBuf::from(lib_path));
2425

0 commit comments

Comments
 (0)