1 // Regression test for this example from #31997 -- main goal is to
2 // emit as minimal and precise an error set as possible. Ideally, we'd
3 // only emit the E0433 error below, but right now we emit two.
5 use std::io::prelude::*;
6 // use std::collections::HashMap;
12 start: Option<String>,
17 let input = io::stdin();
18 let mut input = input.lock();
20 let mut map = HashMap::new();
23 for line in input.lines() {
24 let line = line.unwrap();
25 println!("process: {}", line);
26 let mut parts = line.splitn(2, ":");
27 let _logfile = parts.next().unwrap();
28 let rest = parts.next().unwrap();
29 let mut parts = line.split(" [-] ");
31 let stamp = parts.next().unwrap();
33 let rest = parts.next().unwrap();
34 let words = rest.split_whitespace().collect::<Vec<_>>();
36 let instance = words.iter().find(|a| a.starts_with("i-")).unwrap();
37 let name = words[1].to_owned();
38 let mut entry = map.entry(instance.to_owned()).or_insert(Instance {
44 if rest.contains("terminating") {
45 assert!(entry.end.is_none());
46 entry.end = Some(stamp.to_string());
48 if rest.contains("waiting for") {
49 assert!(entry.start.is_none());
50 entry.start = Some(stamp.to_string());
55 println!("{:?}", map);