diff --git a/src/parser.rs b/src/parser.rs index dfa2ef4..4c63036 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -478,7 +478,7 @@ fn parse_str_words_inside_sq(input: &[u8]) -> IResult<&[u8], &[u8]> { let mut rest = input; loop { (rest, _) = take_while(|c| !b"' ".contains(&c))(rest)?; - if let Ok(_) = alt((recognize(tuple((space1, parse_key, tag("=")))), tag("'")))(rest) { + if alt((recognize(tuple((space1, parse_key, tag("=")))), tag("'")))(rest).is_ok() { break; } (rest, _) = space1(rest)?; diff --git a/src/test.rs b/src/test.rs index fe76ed6..4533db9 100644 --- a/src/test.rs +++ b/src/test.rs @@ -404,7 +404,7 @@ fn test_msg_kv() { let msg = m .body .get("msg") - .expect(&format!("{}: Field msg not found", m.id)); + .unwrap_or_else(|| panic!("{}: Field msg not found", m.id)); match msg { Value::Map(_) => {} Value::Str(_, _) => panic!("{}: Field msg was parsed as string", m.id),