提交 39753c89 编写于 作者: L ljedrz

rustc/driver: improve macro calls

上级 5bfe08fc
......@@ -1472,7 +1472,7 @@ fn write_out_deps(sess: &Session, outputs: &OutputFilenames, out_filenames: &[Pa
.collect();
let mut file = fs::File::create(&deps_filename)?;
for path in out_filenames {
write!(file, "{}: {}\n\n", path.display(), files.join(" "))?;
writeln!(file, "{}: {}\n", path.display(), files.join(" "))?;
}
// Emit a fake target for each input file to the compilation. This
......
......@@ -579,7 +579,7 @@ pub fn set_sigpipe_handler() {
unsafe {
// Set the SIGPIPE signal handler, so that an EPIPE
// will cause rustc to terminate, as expected.
assert!(libc::signal(libc::SIGPIPE, libc::SIG_DFL) != libc::SIG_ERR);
assert_ne!(libc::signal(libc::SIGPIPE, libc::SIG_DFL), libc::SIG_ERR);
}
}
......
......@@ -855,7 +855,7 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec<borrowck_dot::Variant>,
break n.body();
}
let parent = tcx.hir.get_parent_node(node_id);
assert!(node_id != parent);
assert_ne!(node_id, parent);
node_id = parent;
}
}
......
......@@ -109,17 +109,14 @@ fn profile_queries_thread(r:Receiver<ProfileQueriesMsg>) {
let counts_path = format!("{}.counts.txt", params.path);
let mut counts_file = File::create(&counts_path).unwrap();
write!(html_file, "<html>\n").unwrap();
write!(html_file,
"<head>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"{}\">\n",
writeln!(html_file,
"<html>\n<head>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"{}\">",
"profile_queries.css").unwrap();
write!(html_file, "<style>\n").unwrap();
writeln!(html_file, "<style>").unwrap();
trace::write_style(&mut html_file);
write!(html_file, "</style>\n").unwrap();
write!(html_file, "</head>\n").unwrap();
write!(html_file, "<body>\n").unwrap();
writeln!(html_file, "</style>\n</head>\n<body>").unwrap();
trace::write_traces(&mut html_file, &mut counts_file, &frame.traces);
write!(html_file, "</body>\n</html>\n").unwrap();
writeln!(html_file, "</body>\n</html>").unwrap();
let ack_path = format!("{}.ack", params.path);
let ack_file = File::create(&ack_path).unwrap();
......
......@@ -130,22 +130,20 @@ fn write_traces_rec(file: &mut File, traces: &[Rec], total: Duration, depth: usi
let fraction = duration_div(t.dur_total, total);
let percent = fraction * 100.0;
let (frc_text, frc_css_classes) = html_of_fraction(fraction);
write!(file, "<div class=\"trace depth-{} extent-{}{} {} {} {}\">\n",
writeln!(file, "<div class=\"trace depth-{} extent-{}{} {} {} {}\">",
depth,
t.extent.len(),
/* Heuristic for 'important' CSS class: */
if t.extent.len() > 5 || percent >= 1.0 {
" important" }
else { "" },
if t.extent.len() > 5 || percent >= 1.0 { " important" } else { "" },
eff_css_classes,
dur_css_classes,
frc_css_classes,
).unwrap();
write!(file, "<div class=\"eff\">{}</div>\n", eff_text).unwrap();
write!(file, "<div class=\"dur\">{}</div>\n", dur_text).unwrap();
write!(file, "<div class=\"frc\">{}</div>\n", frc_text).unwrap();
writeln!(file, "<div class=\"eff\">{}</div>", eff_text).unwrap();
writeln!(file, "<div class=\"dur\">{}</div>", dur_text).unwrap();
writeln!(file, "<div class=\"frc\">{}</div>", frc_text).unwrap();
write_traces_rec(file, &t.extent, total, depth + 1);
write!(file, "</div>\n").unwrap();
writeln!(file, "</div>").unwrap();
}
}
......@@ -209,7 +207,7 @@ pub fn write_counts(count_file: &mut File, counts: &mut FxHashMap<String,QueryMe
).collect::<Vec<_>>();
data.sort_by_key(|k| Reverse(k.3));
for (cons, count, dur_total, dur_self) in data {
write!(count_file, "{}, {}, {}, {}\n",
writeln!(count_file, "{}, {}, {}, {}",
cons, count,
duration_to_secs_str(dur_total),
duration_to_secs_str(dur_self)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册