From: Scott Worley Date: Thu, 3 Oct 2024 21:12:08 +0000 (-0700) Subject: Make it more clear that the number in an error message is a line number X-Git-Tag: v0.4.0~7 X-Git-Url: http://git.scottworley.com/tablify/commitdiff_plain/1df4654a9fff0f0a1e146c681dc05af7c3e460fe Make it more clear that the number in an error message is a line number --- diff --git a/src/lib.rs b/src/lib.rs index d974461..e20d23d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -174,7 +174,7 @@ impl<'cfg, Input: Iterator>> Iterator InputLine::Entry(col, instance) => match &mut self.row { None => { return Some(Err(std::io::Error::other(format!( - "{}: Entry with no header", + "line {}: Entry with no header", n + 1 )))) } @@ -503,11 +503,11 @@ mod tests { let bad = read_rows(&b" foo"[..]); assert!(bad.is_err()); - assert!(format!("{bad:?}").contains("1: Entry with no header")); + assert!(format!("{bad:?}").contains("line 1: Entry with no header")); let bad2 = read_rows(&b"foo\n\n bar"[..]); assert!(bad2.is_err()); - assert!(format!("{bad2:?}").contains("3: Entry with no header")); + assert!(format!("{bad2:?}").contains("line 3: Entry with no header")); } #[test]