Use write! in utility code, rather than calling write_function directly.

This commit is contained in:
Dan Gohman
2017-05-10 14:58:14 -07:00
committed by Jakob Stoklund Olesen
parent be047ba5c4
commit c571975a5c
3 changed files with 8 additions and 6 deletions

View File

@@ -4,10 +4,11 @@
//! the result to filecheck.
use std::borrow::Cow;
use cretonne::{self, write_function};
use cretonne::{self};
use cretonne::ir::Function;
use cton_reader::TestCommand;
use filetest::subtest::{SubTest, Context, Result, run_filecheck};
use std::fmt::Write;
use utils::pretty_error;
struct TestLegalizer;
@@ -45,7 +46,7 @@ impl SubTest for TestLegalizer {
.map_err(|e| pretty_error(&comp_ctx.func, e))?;
let mut text = String::new();
write_function(&mut text, &comp_ctx.func, Some(isa))
write!(&mut text, "{}", &comp_ctx.func.display(Some(isa)))
.map_err(|e| e.to_string())?;
run_filecheck(&text, context)
}

View File

@@ -6,10 +6,11 @@
//! The resulting function is sent to `filecheck`.
use cretonne::ir::Function;
use cretonne::{self, write_function};
use cretonne::{self};
use cton_reader::TestCommand;
use filetest::subtest::{SubTest, Context, Result, run_filecheck};
use std::borrow::Cow;
use std::fmt::Write;
use utils::pretty_error;
struct TestRegalloc;
@@ -53,7 +54,7 @@ impl SubTest for TestRegalloc {
.map_err(|e| pretty_error(&comp_ctx.func, e))?;
let mut text = String::new();
write_function(&mut text, &comp_ctx.func, Some(isa))
write!(&mut text, "{}", &comp_ctx.func.display(Some(isa)))
.map_err(|e| e.to_string())?;
run_filecheck(&text, context)
}