pub fn fix_line_issues(mut line: String) -> std::io::Result<String> {
if !line.ends_with('\n') {
return Err(std::io::Error::new(
std::io::ErrorKind::UnexpectedEof,
"unexpected end of file",
));
}
line.pop();
if line.ends_with('\r') {
line.pop();
}
if line.contains('') {
line = match line.rfind('') {
Some(last_ctrl_u_index) => line[last_ctrl_u_index + 1..].to_string(),
None => line,
};
}
Ok(line)
}