diff --git a/crates/compiler/mono/src/layout/intern.rs b/crates/compiler/mono/src/layout/intern.rs index f6d2f023f9..9c1713f7ca 100644 --- a/crates/compiler/mono/src/layout/intern.rs +++ b/crates/compiler/mono/src/layout/intern.rs @@ -1,9 +1,4 @@ -use std::{ - cell::RefCell, - hash::{BuildHasher, Hasher}, - marker::PhantomData, - sync::Arc, -}; +use std::{cell::RefCell, hash::BuildHasher, marker::PhantomData, sync::Arc}; use bumpalo::Bump; use parking_lot::{Mutex, RwLock}; @@ -591,12 +586,8 @@ struct LockedGlobalInterner<'a, 'r> { /// /// This uses the [default_hasher], so interner maps should also rely on [default_hasher]. fn hash(val: V) -> u64 { - let mut state = roc_collections::all::BuildHasher::default().build_hasher(); - val.hash(&mut state); - - // clippy suggests a stylistic improvement but the suggested fix doesn't seem to work out - #[allow(clippy::manual_hash_one)] - state.finish() + let hasher = roc_collections::all::BuildHasher::default(); + hasher.hash_one(&val) } #[inline(always)] diff --git a/crates/compiler/parse/src/expr.rs b/crates/compiler/parse/src/expr.rs index 0fe317ad16..4dcb541305 100644 --- a/crates/compiler/parse/src/expr.rs +++ b/crates/compiler/parse/src/expr.rs @@ -264,22 +264,22 @@ fn crash_kw<'a>() -> impl Parser<'a, Expr<'a>, EExpr<'a>> { } } -// avoids ownership issues -#[allow(clippy::blocks_in_conditions)] fn loc_possibly_negative_or_negated_term<'a>( options: ExprParseOptions, ) -> impl Parser<'a, Loc>, EExpr<'a>> { + let parse_unary_negate = move |arena, state: State<'a>, min_indent: u32| { + let initial = state.clone(); + + let (_, (loc_op, loc_expr), state) = + and!(loc!(unary_negate()), loc_term(options)).parse(arena, state, min_indent)?; + + let loc_expr = numeric_negate_expression(arena, initial, loc_op, loc_expr, &[]); + + Ok((MadeProgress, loc_expr, state)) + }; + one_of![ - |arena, state: State<'a>, min_indent: u32| { - let initial = state.clone(); - - let (_, (loc_op, loc_expr), state) = - and!(loc!(unary_negate()), loc_term(options)).parse(arena, state, min_indent)?; - - let loc_expr = numeric_negate_expression(arena, initial, loc_op, loc_expr, &[]); - - Ok((MadeProgress, loc_expr, state)) - }, + parse_unary_negate, // this will parse negative numbers, which the unary negate thing up top doesn't (for now) loc!(specialize_err(EExpr::Number, number_literal_help())), loc!(map_with_arena!( diff --git a/crates/compiler/test_gen/src/helpers/llvm.rs b/crates/compiler/test_gen/src/helpers/llvm.rs index 6a71968fe7..55d346f193 100644 --- a/crates/compiler/test_gen/src/helpers/llvm.rs +++ b/crates/compiler/test_gen/src/helpers/llvm.rs @@ -335,7 +335,8 @@ pub fn helper<'a>( let (main_fn_name, delayed_errors, module) = create_llvm_module(arena, src, config, context, target, function_kind); - //module.print_to_file(std::path::Path::new("/home/username/gitrepos/roc4/roc/str_to_u128.ll")).unwrap(); + // for debugging: + //module.print_to_file(std::path::Path::new("/home/username/roc/llvm_ir.ll")).unwrap(); if !config.emit_debug_info { module.strip_debug_info();