Use to_string() instead of write!(&mut text, "{}", ....

This commit is contained in:
Dan Gohman
2018-06-04 16:29:13 -07:00
parent 4a4453dc47
commit 1087ff3a01
8 changed files with 8 additions and 24 deletions

View File

@@ -7,7 +7,6 @@ use cretonne_codegen::print_errors::pretty_error;
use cretonne_codegen::{binemit, ir};
use cretonne_reader::TestCommand;
use std::borrow::Cow;
use std::fmt::Write;
use subtest::{run_filecheck, Context, Result, SubTest};
struct TestCompile;
@@ -64,8 +63,7 @@ impl SubTest for TestCompile {
}
// Run final code through filecheck.
let mut text = String::new();
write!(&mut text, "{}", &comp_ctx.func.display(Some(isa))).map_err(|e| e.to_string())?;
let text = comp_ctx.func.display(Some(isa)).to_string();
run_filecheck(&text, context)
}
}