From fc73679932fa183ab8fea2a7d86644f2a26060f8 Mon Sep 17 00:00:00 2001 From: Folkert Date: Sat, 7 Nov 2020 01:17:50 +0100 Subject: [PATCH] more clippy things --- compiler/load/src/file.rs | 7 +++---- compiler/mono/src/ir.rs | 27 +++++++++++++++------------ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/compiler/load/src/file.rs b/compiler/load/src/file.rs index 6ae97335d6..16c39d9dc2 100644 --- a/compiler/load/src/file.rs +++ b/compiler/load/src/file.rs @@ -151,14 +151,12 @@ impl Dependencies { } } - let output = MutSet::default(); - // // all the dependencies can be loaded // for dep in dependencies { // output.insert((*dep, LoadHeader)); // } - output + MutSet::default() } /// Propagate a notification, return (module, phase) pairs that can make progress @@ -1761,6 +1759,7 @@ fn find_task(local: &Worker, global: &Injector, stealers: &[Stealer] }) } +#[allow(clippy::too_many_arguments)] fn parse_header<'a>( arena: &'a Bump, read_file_duration: Duration, @@ -2119,7 +2118,7 @@ fn run_solve<'a>( } } -fn fabricate_effect_after<'a>( +fn fabricate_effect_after( env: &mut roc_can::env::Env, scope: &mut roc_can::scope::Scope, effect_symbol: Symbol, diff --git a/compiler/mono/src/ir.rs b/compiler/mono/src/ir.rs index de633cfb33..dbbf6d08cb 100644 --- a/compiler/mono/src/ir.rs +++ b/compiler/mono/src/ir.rs @@ -1358,7 +1358,7 @@ pub fn specialize_all<'a>( let hash_the_thing = |x: &SolvedType| { let mut hasher = DefaultHasher::new(); x.hash(&mut hasher); - (hasher.finish()); + hasher.finish() }; as_vec.sort_by_key(|x| hash_the_thing(x)); @@ -1780,18 +1780,21 @@ fn build_specialized_proc<'a>( // make sure there is not arg_closure argument without a closure layout debug_assert!(pattern_symbols.last() != Some(&Symbol::ARG_CLOSURE)); - let diff = pattern_layouts_len - pattern_symbols.len(); + use std::cmp::Ordering; + match pattern_layouts_len.cmp(&pattern_symbols.len()) { + Ordering::Greater => { + let proc_args = proc_args.into_bump_slice(); - if diff == 0 { - let proc_args = proc_args.into_bump_slice(); - - Ok((proc_args, None, ret_layout)) - } else if diff > 0 { - // so far, the problem when hitting this branch was always somewhere else - // I think this branch should not be reachable in a bugfree compiler - panic!("more arguments (according to the layout) than argument symbols") - } else { - panic!("more argument symbols than arguments (according to the layout)") + Ok((proc_args, None, ret_layout)) + } + Ordering::Less => { + // so far, the problem when hitting this branch was always somewhere else + // I think this branch should not be reachable in a bugfree compiler + panic!("more arguments (according to the layout) than argument symbols") + } + Ordering::Equal => { + panic!("more argument symbols than arguments (according to the layout)") + } } } }