mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
cargo fmt AGAIN
This commit is contained in:
parent
b65a69f07e
commit
e57a539a66
2 changed files with 11 additions and 13 deletions
|
@ -66,17 +66,15 @@ pub fn parse_single_quote<'a>() -> impl Parser<'a, &'a str, EString<'a>> {
|
|||
match state.bytes.first() {
|
||||
Some(&ch) => {
|
||||
state = advance_state!(state, 1)?;
|
||||
if (ch == b'n' || ch == b'r' || ch == b't' || ch == b'\'' || ch == b'\\') && (state.bytes.first() == Some(&b'\'')) {
|
||||
state = advance_state!(state, 1)?;
|
||||
// since we checked the current char between the single quotes we
|
||||
// know they are valid UTF-8, allowing us to use 'from_u32_unchecked'
|
||||
let test = unsafe { char::from_u32_unchecked(ch as u32) };
|
||||
if (ch == b'n' || ch == b'r' || ch == b't' || ch == b'\'' || ch == b'\\')
|
||||
&& (state.bytes.first() == Some(&b'\''))
|
||||
{
|
||||
state = advance_state!(state, 1)?;
|
||||
// since we checked the current char between the single quotes we
|
||||
// know they are valid UTF-8, allowing us to use 'from_u32_unchecked'
|
||||
let test = unsafe { char::from_u32_unchecked(ch as u32) };
|
||||
|
||||
return Ok((
|
||||
MadeProgress,
|
||||
&*arena.alloc_str(&test.to_string()),
|
||||
state,
|
||||
));
|
||||
return Ok((MadeProgress, &*arena.alloc_str(&test.to_string()), state));
|
||||
}
|
||||
// invalid error, backslah escaping something we do not recognize
|
||||
return Err((
|
||||
|
@ -142,9 +140,7 @@ pub fn parse_single_quote<'a>() -> impl Parser<'a, &'a str, EString<'a>> {
|
|||
|
||||
state = advance_state!(state, end_index)?;
|
||||
match std::str::from_utf8(raw_bytes) {
|
||||
Ok(string) => {
|
||||
Ok((MadeProgress, string, state))
|
||||
}
|
||||
Ok(string) => Ok((MadeProgress, string, state)),
|
||||
Err(_) => {
|
||||
// invalid UTF-8
|
||||
return Err((
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue