diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2020-10-19 11:50:36 -0400 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2020-10-30 20:02:15 -0400 |
| commit | 4621ce9858856389c32f890725feac489bc94ac5 (patch) | |
| tree | 7889399f95811accfd55e278cfa308d2bb2b9f82 /src/tools/compiletest | |
| parent | 4b4f84f3274e2d5662c76f52769ac4b7e6826fcf (diff) | |
| download | rust-4621ce9858856389c32f890725feac489bc94ac5.tar.gz rust-4621ce9858856389c32f890725feac489bc94ac5.zip | |
Update into-iter-on-arrays test to check future-incompat-report
Diffstat (limited to 'src/tools/compiletest')
| -rw-r--r-- | src/tools/compiletest/src/json.rs | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/tools/compiletest/src/json.rs b/src/tools/compiletest/src/json.rs index 8eeaf8b1bb5..176c3219307 100644 --- a/src/tools/compiletest/src/json.rs +++ b/src/tools/compiletest/src/json.rs @@ -38,13 +38,13 @@ struct DiagnosticSpan { #[derive(Deserialize)] struct FutureIncompatReport { - future_incompat_report: Vec<FutureBreakageItem> + future_incompat_report: Vec<FutureBreakageItem>, } #[derive(Deserialize)] struct FutureBreakageItem { future_breakage_date: Option<String>, - diagnostic: Diagnostic + diagnostic: Diagnostic, } impl DiagnosticSpan { @@ -80,9 +80,10 @@ struct DiagnosticCode { } pub fn rustfix_diagnostics_only(output: &str) -> String { - output.lines().filter(|line| { - line.starts_with('{') && serde_json::from_str::<Diagnostic>(line).is_ok() - }).collect() + output + .lines() + .filter(|line| line.starts_with('{') && serde_json::from_str::<Diagnostic>(line).is_ok()) + .collect() } pub fn extract_rendered(output: &str) -> String { @@ -93,12 +94,22 @@ pub fn extract_rendered(output: &str) -> String { if let Ok(diagnostic) = serde_json::from_str::<Diagnostic>(line) { diagnostic.rendered } else if let Ok(report) = serde_json::from_str::<FutureIncompatReport>(line) { - Some(format!("Future incompatibility report: {}", - report.future_incompat_report.into_iter().map(|item| { - format!("Future breakage date: {}, diagnostic:\n{}", - item.future_breakage_date.unwrap_or_else(|| "None".to_string()), - item.diagnostic.rendered.unwrap_or_else(|| "Not rendered".to_string())) - }).collect::<String>())) + Some(format!( + "Future incompatibility report: {}", + report + .future_incompat_report + .into_iter() + .map(|item| { + format!( + "Future breakage date: {}, diagnostic:\n{}", + item.future_breakage_date.unwrap_or_else(|| "None".to_string()), + item.diagnostic + .rendered + .unwrap_or_else(|| "Not rendered".to_string()) + ) + }) + .collect::<String>() + )) } else if serde_json::from_str::<ArtifactNotification>(line).is_ok() { // Ignore the notification. None |
