From b65a69f07e5182366c2ec068b9b80e76838e29dc Mon Sep 17 00:00:00 2001 From: Chelsea Troy Date: Wed, 1 Dec 2021 18:56:15 -0600 Subject: [PATCH] Appeasing the clippy --- compiler/can/src/expr.rs | 4 ++-- compiler/parse/src/string_literal.rs | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/compiler/can/src/expr.rs b/compiler/can/src/expr.rs index 8d59c444dd..39eded4771 100644 --- a/compiler/can/src/expr.rs +++ b/compiler/can/src/expr.rs @@ -313,14 +313,14 @@ pub fn canonicalize_expr<'a>( } else { // multiple chars is found let error = roc_problem::can::RuntimeError::MultipleCharsInSingleQuote(region); - let answer = Expr::RuntimeError(error.clone()); + let answer = Expr::RuntimeError(error); (answer, Output::default()) } } else { // no characters found let error = roc_problem::can::RuntimeError::EmptySingleQuote(region); - let answer = Expr::RuntimeError(error.clone()); + let answer = Expr::RuntimeError(error); (answer, Output::default()) } diff --git a/compiler/parse/src/string_literal.rs b/compiler/parse/src/string_literal.rs index 7844651f66..e766fa6a9f 100644 --- a/compiler/parse/src/string_literal.rs +++ b/compiler/parse/src/string_literal.rs @@ -66,8 +66,7 @@ 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'\\' { - if state.bytes.first() == Some(&b'\'') { + 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' @@ -78,7 +77,6 @@ pub fn parse_single_quote<'a>() -> impl Parser<'a, &'a str, EString<'a>> { &*arena.alloc_str(&test.to_string()), state, )); - } } // invalid error, backslah escaping something we do not recognize return Err(( @@ -145,7 +143,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) => { - return Ok((MadeProgress, string, state)); + Ok((MadeProgress, string, state)) } Err(_) => { // invalid UTF-8