clippy --fix fixes

This commit is contained in:
Folkert 2023-04-21 12:05:51 +02:00
parent 9973d4b8d2
commit 4cd8f0a056
57 changed files with 366 additions and 374 deletions

View file

@ -25,9 +25,9 @@ use crate::{
/**
Insert the reference count operations for procedures.
*/
pub fn insert_inc_dec_operations<'a, 'i>(
pub fn insert_inc_dec_operations<'a>(
arena: &'a Bump,
layout_interner: &'i STLayoutInterner<'a>,
layout_interner: &STLayoutInterner<'a>,
procedures: &mut HashMap<(Symbol, ProcLayout), Proc<'a>, BuildHasherDefault<WyHash>>,
) {
// Create a SymbolRcTypesEnv for the procedures as they get referenced but should be marked as non reference counted.
@ -401,9 +401,9 @@ impl<'v> RefcountEnvironment<'v> {
/**
Insert the reference counting operations into a statement.
*/
fn insert_inc_dec_operations_proc<'a, 'i>(
fn insert_inc_dec_operations_proc<'a>(
arena: &'a Bump,
mut symbol_rc_types_env: SymbolRcTypesEnv<'a, 'i>,
mut symbol_rc_types_env: SymbolRcTypesEnv<'a, '_>,
proc: &mut Proc<'a>,
) {
// Clone the symbol_rc_types_env and insert the symbols in the current procedure.

View file

@ -280,7 +280,9 @@ impl AbilityAliases {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[derive(Default)]
pub enum CapturedSymbols<'a> {
#[default]
None,
Captured(&'a [(Symbol, Variable)]),
}
@ -294,11 +296,7 @@ impl<'a> CapturedSymbols<'a> {
}
}
impl<'a> Default for CapturedSymbols<'a> {
fn default() -> Self {
CapturedSymbols::None
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct Proc<'a> {
@ -2722,8 +2720,8 @@ fn patterns_to_when<'a>(
/// { x } -> body
///
/// conversion of one-pattern when expressions will do the most optimal thing
fn pattern_to_when<'a>(
env: &mut Env<'a, '_>,
fn pattern_to_when(
env: &mut Env<'_, '_>,
pattern_var: Variable,
pattern: Loc<roc_can::pattern::Pattern>,
body_var: Variable,
@ -5740,8 +5738,8 @@ fn compile_struct_like<'a, L, UnusedLayout>(
}
#[inline(always)]
fn late_resolve_ability_specialization<'a>(
env: &mut Env<'a, '_>,
fn late_resolve_ability_specialization(
env: &mut Env<'_, '_>,
member: Symbol,
specialization_id: Option<SpecializationId>,
specialization_var: Variable,

View file

@ -1193,7 +1193,7 @@ fn extract<'a>(
/// FIND IRRELEVANT BRANCHES
fn is_irrelevant_to<'a>(selected_path: &[PathInstruction], branch: &Branch<'a>) -> bool {
fn is_irrelevant_to(selected_path: &[PathInstruction], branch: &Branch<'_>) -> bool {
match branch
.patterns
.iter()
@ -1720,7 +1720,7 @@ fn test_to_comparison<'a>(
Test::IsFloat(test_int, precision) => {
// TODO maybe we can actually use i64 comparison here?
let test_float = f64::from_bits(test_int as u64);
let test_float = f64::from_bits(test_int);
let lhs = Expr::Literal(Literal::Float(test_float));
let lhs_symbol = env.unique_symbol();
stores.push((lhs_symbol, Layout::float_width(precision), lhs));
@ -2240,7 +2240,7 @@ fn decide_to_branching<'a>(
let tag = match test {
Test::IsInt(v, _) => i128::from_ne_bytes(v) as u64,
Test::IsFloat(v, _) => v as u64,
Test::IsFloat(v, _) => v,
Test::IsBit(v) => v as u64,
Test::IsByte { tag_id, .. } => tag_id as u64,
Test::IsCtor { tag_id, .. } => tag_id as u64,

View file

@ -457,7 +457,7 @@ macro_rules! cached {
}
pub type TagIdIntType = u16;
pub const MAX_ENUM_SIZE: usize = (std::mem::size_of::<TagIdIntType>() * 8) as usize;
pub const MAX_ENUM_SIZE: usize = std::mem::size_of::<TagIdIntType>() * 8;
const GENERATE_NULLABLE: bool = true;
#[derive(Debug, Clone, Copy)]
@ -898,7 +898,7 @@ impl<'a> UnionLayout<'a> {
} => {
debug_assert_ne!(nullable_id, tag_id != 0);
other_fields[index as usize]
other_fields[index]
}
};

View file

@ -23,7 +23,7 @@ macro_rules! cache_interned_layouts {
)*
}
fn fill_reserved_layouts<'a>(interner: &mut STLayoutInterner<'a>) {
fn fill_reserved_layouts(interner: &mut STLayoutInterner<'_>) {
assert!(interner.is_empty());
$(
interner.insert($layout);

View file

@ -1128,8 +1128,8 @@ impl<'a> ReuseEnvironment<'a> {
/**
Check if a layout can be reused. by verifying if the layout is a union and if the tag is not nullable.
*/
fn can_reuse_layout<'a, 'i>(
layout_interner: &'i STLayoutInterner<'a>,
fn can_reuse_layout<'a>(
layout_interner: &STLayoutInterner<'a>,
environment: &ReuseEnvironment<'a>,
layout: &InLayout<'a>,
) -> Reuse {