Update error.rs

This commit is contained in:
sunli 2020-04-02 12:57:53 +08:00
parent 506e82895f
commit 9d09ba04b0

View File

@ -229,11 +229,11 @@ pub struct RuleError {
impl From<ParseError> for Error {
fn from(err: ParseError) -> Self {
let msg = err.to_string();
let mut s = msg.splitn(2, "\n");
let mut s = msg.splitn(2, '\n');
let first = s.next().unwrap();
let ln = &first[first.rfind(" ").unwrap() + 1..];
let ln = &first[first.rfind(' ').unwrap() + 1..];
let (line, column) = {
let mut s = ln.splitn(2, ":");
let mut s = ln.splitn(2, ':');
(
s.next().unwrap().parse().unwrap(),
s.next().unwrap().parse().unwrap(),