diff --git a/cargo-miri/src/main.rs b/cargo-miri/src/main.rs index 30b03c57dba..09e2cd3c286 100644 --- a/cargo-miri/src/main.rs +++ b/cargo-miri/src/main.rs @@ -11,7 +11,7 @@ use std::{env, iter}; -use crate::{phases::*, util::*}; +use crate::phases::*; fn main() { // Rustc does not support non-UTF-8 arguments so we make no attempt either. diff --git a/cargo-miri/src/util.rs b/cargo-miri/src/util.rs index 8095958d21d..8f29eebaac1 100644 --- a/cargo-miri/src/util.rs +++ b/cargo-miri/src/util.rs @@ -14,13 +14,13 @@ pub use crate::arg::*; -pub fn show_error(msg: &str) -> ! { +pub fn show_error(msg: &impl std::fmt::Display) -> ! { eprintln!("fatal error: {msg}"); std::process::exit(1) } macro_rules! show_error { - ($($tt:tt)*) => { show_error(&format!($($tt)*)) }; + ($($tt:tt)*) => { crate::util::show_error(&format_args!($($tt)*)) }; } /// The information to run a crate with the given environment. diff --git a/src/bin/miri.rs b/src/bin/miri.rs index 3325fc97d82..ca0787b2298 100644 --- a/src/bin/miri.rs +++ b/src/bin/miri.rs @@ -152,13 +152,13 @@ fn config(&mut self, config: &mut Config) { } } -fn show_error(msg: &str) -> ! { +fn show_error(msg: &impl std::fmt::Display) -> ! { eprintln!("fatal error: {msg}"); std::process::exit(1) } macro_rules! show_error { - ($($tt:tt)*) => { show_error(&format!($($tt)*)) }; + ($($tt:tt)*) => { show_error(&format_args!($($tt)*)) }; } fn init_early_loggers() {