From fce4c232d3e773084926bacc9da6e7ab72f55b17 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Fri, 19 Apr 2019 04:07:29 -0700 Subject: [PATCH] Remove `write_token_error_context` (#417) --- src/runtime_error.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/runtime_error.rs b/src/runtime_error.rs index 5c999ce..d32ad70 100644 --- a/src/runtime_error.rs +++ b/src/runtime_error.rs @@ -4,17 +4,6 @@ use brev::OutputError; use crate::misc::{maybe_s, ticks, write_error_context, And, Or, Tick}; -fn write_token_error_context(f: &mut Formatter, token: &Token) -> Result<(), fmt::Error> { - write_error_context( - f, - token.text, - token.offset, - token.line, - token.column, - token.lexeme().len(), - ) -} - #[derive(Debug)] pub enum RuntimeError<'a> { ArgumentCountMismatch { @@ -400,7 +389,14 @@ impl<'a> Display for RuntimeError<'a> { write!(f, "{}", message.suffix())?; if let Some(token) = error_token { - write_token_error_context(f, token)?; + write_error_context( + f, + token.text, + token.offset, + token.line, + token.column, + token.lexeme().len(), + )?; } Ok(())