rust-csv
rust-csv copied to clipboard
`Position::line` reports inaccurate line following blank lines
What version of the csv crate are you using?
1.1.3
Briefly describe the question, bug or feature request.
Reader reasonably skips blank lines, and the reported position following them is largely still correct, except for the first record following the blank. The first record after a blank line reports the blank's line number rather than its own.
Include a complete program demonstrating a problem.
Rust program:
fn main() {
let mut rdr = csv::Reader::from_reader(std::io::stdin());
for result in rdr.records() {
let record = result.unwrap();
let expected: u64 = record.get(0).unwrap().parse().unwrap();
let actual = record.position().unwrap().line();
if expected != actual {
println!("expected: {}", expected);
println!("actual: {}", actual);
}
}
}
With CSV input:
line number
2
4
5
What is the observed behavior of the code above?
expected: 4
actual: 3
What is the expected or desired behavior of the code above?
No output.