diff --git a/lib/filetests/src/test_compile.rs b/lib/filetests/src/test_compile.rs index 8cb26b4f1f..73f178b9b7 100644 --- a/lib/filetests/src/test_compile.rs +++ b/lib/filetests/src/test_compile.rs @@ -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) } } diff --git a/lib/filetests/src/test_dce.rs b/lib/filetests/src/test_dce.rs index 38e2b907a9..4c795b5a2e 100644 --- a/lib/filetests/src/test_dce.rs +++ b/lib/filetests/src/test_dce.rs @@ -10,7 +10,6 @@ use cretonne_codegen::ir::Function; use cretonne_codegen::print_errors::pretty_error; use cretonne_reader::TestCommand; use std::borrow::Cow; -use std::fmt::Write; use subtest::{run_filecheck, Context, Result, SubTest}; struct TestDCE; @@ -42,8 +41,7 @@ impl SubTest for TestDCE { .dce(context.flags_or_isa()) .map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?; - let mut text = String::new(); - write!(&mut text, "{}", &comp_ctx.func).map_err(|e| e.to_string())?; + let text = comp_ctx.func.to_string(); run_filecheck(&text, context) } } diff --git a/lib/filetests/src/test_legalizer.rs b/lib/filetests/src/test_legalizer.rs index 8ce1cffb1b..afaaf3fdcb 100644 --- a/lib/filetests/src/test_legalizer.rs +++ b/lib/filetests/src/test_legalizer.rs @@ -8,7 +8,6 @@ use cretonne_codegen::ir::Function; use cretonne_codegen::print_errors::pretty_error; use cretonne_reader::TestCommand; use std::borrow::Cow; -use std::fmt::Write; use subtest::{run_filecheck, Context, Result, SubTest}; struct TestLegalizer; @@ -44,8 +43,7 @@ impl SubTest for TestLegalizer { .legalize(isa) .map_err(|e| pretty_error(&comp_ctx.func, context.isa, e))?; - 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) } } diff --git a/lib/filetests/src/test_licm.rs b/lib/filetests/src/test_licm.rs index 2dda7b976b..9f42254a18 100644 --- a/lib/filetests/src/test_licm.rs +++ b/lib/filetests/src/test_licm.rs @@ -10,7 +10,6 @@ use cretonne_codegen::ir::Function; use cretonne_codegen::print_errors::pretty_error; use cretonne_reader::TestCommand; use std::borrow::Cow; -use std::fmt::Write; use subtest::{run_filecheck, Context, Result, SubTest}; struct TestLICM; @@ -42,8 +41,7 @@ impl SubTest for TestLICM { .licm(context.flags_or_isa()) .map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?; - let mut text = String::new(); - write!(&mut text, "{}", &comp_ctx.func).map_err(|e| e.to_string())?; + let text = comp_ctx.func.to_string(); run_filecheck(&text, context) } } diff --git a/lib/filetests/src/test_postopt.rs b/lib/filetests/src/test_postopt.rs index 72bc3dfc2f..6e3712922f 100644 --- a/lib/filetests/src/test_postopt.rs +++ b/lib/filetests/src/test_postopt.rs @@ -7,7 +7,6 @@ use cretonne_codegen::ir::Function; use cretonne_codegen::print_errors::pretty_error; use cretonne_reader::TestCommand; use std::borrow::Cow; -use std::fmt::Write; use subtest::{run_filecheck, Context, Result, SubTest}; struct TestPostopt; @@ -39,8 +38,7 @@ impl SubTest for TestPostopt { .postopt(isa) .map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?; - let mut text = String::new(); - write!(&mut text, "{}", &comp_ctx.func).map_err(|e| e.to_string())?; + let text = comp_ctx.func.to_string(); run_filecheck(&text, context) } } diff --git a/lib/filetests/src/test_preopt.rs b/lib/filetests/src/test_preopt.rs index 1a3131ba83..ad68e59c09 100644 --- a/lib/filetests/src/test_preopt.rs +++ b/lib/filetests/src/test_preopt.rs @@ -7,7 +7,6 @@ use cretonne_codegen::ir::Function; use cretonne_codegen::print_errors::pretty_error; use cretonne_reader::TestCommand; use std::borrow::Cow; -use std::fmt::Write; use subtest::{run_filecheck, Context, Result, SubTest}; struct TestPreopt; @@ -39,8 +38,7 @@ impl SubTest for TestPreopt { .preopt(isa) .map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?; - let mut text = String::new(); - write!(&mut text, "{}", &comp_ctx.func).map_err(|e| e.to_string())?; + let text = &comp_ctx.func.to_string(); run_filecheck(&text, context) } } diff --git a/lib/filetests/src/test_regalloc.rs b/lib/filetests/src/test_regalloc.rs index c74662c19a..b592cd12dc 100644 --- a/lib/filetests/src/test_regalloc.rs +++ b/lib/filetests/src/test_regalloc.rs @@ -10,7 +10,6 @@ use cretonne_codegen::ir::Function; use cretonne_codegen::print_errors::pretty_error; use cretonne_reader::TestCommand; use std::borrow::Cow; -use std::fmt::Write; use subtest::{run_filecheck, Context, Result, SubTest}; struct TestRegalloc; @@ -51,8 +50,7 @@ impl SubTest for TestRegalloc { .regalloc(isa) .map_err(|e| pretty_error(&comp_ctx.func, context.isa, e))?; - 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) } } diff --git a/lib/filetests/src/test_simple_gvn.rs b/lib/filetests/src/test_simple_gvn.rs index 7def78e95a..a78d30753c 100644 --- a/lib/filetests/src/test_simple_gvn.rs +++ b/lib/filetests/src/test_simple_gvn.rs @@ -10,7 +10,6 @@ use cretonne_codegen::ir::Function; use cretonne_codegen::print_errors::pretty_error; use cretonne_reader::TestCommand; use std::borrow::Cow; -use std::fmt::Write; use subtest::{run_filecheck, Context, Result, SubTest}; struct TestSimpleGVN; @@ -41,8 +40,7 @@ impl SubTest for TestSimpleGVN { .simple_gvn(context.flags_or_isa()) .map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?; - let mut text = String::new(); - write!(&mut text, "{}", &comp_ctx.func).map_err(|e| e.to_string())?; + let text = comp_ctx.func.to_string(); run_filecheck(&text, context) } }