From 992141878227439cd517d05b68f15e57d77452a5 Mon Sep 17 00:00:00 2001 From: Akshay Date: Mon, 29 Mar 2021 10:24:49 +0530 Subject: fix: handle unterminated strings gracefully --- src/lisp/error.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lisp/error.rs') diff --git a/src/lisp/error.rs b/src/lisp/error.rs index a360eb2..6d28c22 100644 --- a/src/lisp/error.rs +++ b/src/lisp/error.rs @@ -30,9 +30,9 @@ impl ParseError { pub fn new(span: Span, kind: ParseErrorKind) -> Self { Self { span, kind } } - pub fn fmt(&self, f: &mut fmt::Formatter<'_>, text: &str) -> fmt::Result { + pub fn display(&self, text: &str) -> String { let SpanDisplay { line, col, .. } = SpanDisplay::highlight_span(self.span, text); - write!(f, "line {}, col {}: {}", line, col, self.kind) + format!("line {}, col {}: {}", line, col, self.kind) } } -- cgit v1.2.3