refactor(report): Rename source field

This commit is contained in:
Ed Page 2019-06-22 22:01:27 -06:00
parent 859769b835
commit b12e90c141
2 changed files with 6 additions and 6 deletions

View file

@ -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: (),
};

View file

@ -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!(