Skip to content

Commit

Permalink
rustc/driver: simplify profile::trace::cons
Browse files Browse the repository at this point in the history
  • Loading branch information
ljedrz committed Oct 12, 2018
1 parent 71d3a71 commit 5bfe08f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/librustc_driver/profile/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ pub struct QueryMetric {
pub dur_total: Duration,
}

fn cons(s: &str) -> String {
let first = s.split(|d| d == '(' || d == '{').next();
assert!(first.is_some() && first != Some(""));
first.unwrap().to_owned()
}

pub fn cons_of_query_msg(q: &trace::Query) -> String {
let s = format!("{:?}", q.msg);
let cons: Vec<&str> = s.split(|d| d == '(' || d == '{').collect();
assert!(cons.len() > 0 && cons[0] != "");
cons[0].to_string()
cons(&format!("{:?}", q.msg))
}

pub fn cons_of_key(k: &DepNode) -> String {
let s = format!("{:?}", k);
let cons: Vec<&str> = s.split(|d| d == '(' || d == '{').collect();
assert!(cons.len() > 0 && cons[0] != "");
cons[0].to_string()
cons(&format!("{:?}", k))
}

// First return value is text; second return value is a CSS class
Expand Down

0 comments on commit 5bfe08f

Please sign in to comment.