From b12e90c141ed9a27fb79496d5ea15a73260b3801 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Sat, 22 Jun 2019 22:01:27 -0600 Subject: [PATCH] refactor(report): Rename source field --- src/lib.rs | 4 ++-- src/report.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index df4561f..2c9f1f9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,7 +29,7 @@ pub fn process_file( line, line_num, col_num, - word: ident.token(), + typo: ident.token(), correction, non_exhaustive: (), }; @@ -43,7 +43,7 @@ pub fn process_file( line, line_num, col_num, - word: word.token(), + typo: word.token(), correction, non_exhaustive: (), }; diff --git a/src/report.rs b/src/report.rs index f501f64..09e9c07 100644 --- a/src/report.rs +++ b/src/report.rs @@ -7,7 +7,7 @@ pub struct Message<'m> { pub line: &'m [u8], pub line_num: usize, pub col_num: usize, - pub word: &'m str, + pub typo: &'m str, pub correction: &'m str, #[serde(skip)] pub(crate) non_exhaustive: (), @@ -23,7 +23,7 @@ pub fn print_brief(msg: Message) { msg.path.display(), msg.line_num, msg.col_num, - msg.word, + msg.typo, msg.correction ); } @@ -33,7 +33,7 @@ pub fn print_long(msg: Message) { let line_indent: String = itertools::repeat_n(" ", line_num.len()).collect(); let hl_indent: String = itertools::repeat_n(" ", msg.col_num).collect(); - let hl: String = itertools::repeat_n("^", msg.word.len()).collect(); + let hl: String = itertools::repeat_n("^", msg.typo.len()).collect(); let line = String::from_utf8_lossy(msg.line); let line = line.replace("\t", " "); @@ -44,7 +44,7 @@ pub fn print_long(msg: Message) { writeln!( handle, "error: `{}` should be `{}`", - msg.word, msg.correction + msg.typo, msg.correction ) .unwrap(); writeln!(