many clippy fixes

This commit is contained in:
Anton-4 2023-04-24 16:21:46 +02:00
parent 7bbb37a843
commit 9748e4a4dc
No known key found for this signature in database
GPG key ID: 0971D718C0A9B937
17 changed files with 455 additions and 600 deletions

View file

@ -10,8 +10,8 @@ use roc_mono::layout::{
};
use roc_target::TargetInfo;
fn basic_type_from_record<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn basic_type_from_record<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
fields: &[InLayout<'_>],
) -> BasicTypeEnum<'ctx> {
@ -59,8 +59,8 @@ pub fn basic_type_from_layout<'a, 'ctx, 'env>(
}
}
pub fn struct_type_from_union_layout<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn struct_type_from_union_layout<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
union_layout: &UnionLayout<'_>,
) -> StructType<'ctx> {
@ -98,8 +98,8 @@ pub fn struct_type_from_union_layout<'a, 'ctx, 'env>(
}
}
pub fn basic_type_from_union_layout<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn basic_type_from_union_layout<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
union_layout: &UnionLayout<'_>,
) -> BasicTypeEnum<'ctx> {
@ -116,8 +116,8 @@ pub fn basic_type_from_union_layout<'a, 'ctx, 'env>(
}
}
pub fn basic_type_from_builtin<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn basic_type_from_builtin<'ctx>(
env: &Env<'_, 'ctx, '_>,
builtin: &Builtin<'_>,
) -> BasicTypeEnum<'ctx> {
use Builtin::*;
@ -145,8 +145,8 @@ pub fn basic_type_from_builtin<'a, 'ctx, 'env>(
///
/// Ideas exist to have (bigger than 2 register) records also be passed by-reference, but this
/// is not currently implemented
pub fn argument_type_from_layout<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn argument_type_from_layout<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
layout: InLayout<'a>,
) -> BasicTypeEnum<'ctx> {
@ -171,8 +171,8 @@ pub fn argument_type_from_layout<'a, 'ctx, 'env>(
}
/// Non-recursive tag unions are stored on the stack, but passed by-reference
pub fn argument_type_from_union_layout<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn argument_type_from_union_layout<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
union_layout: &UnionLayout<'_>,
) -> BasicTypeEnum<'ctx> {
@ -185,8 +185,8 @@ pub fn argument_type_from_union_layout<'a, 'ctx, 'env>(
}
}
pub fn int_type_from_int_width<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn int_type_from_int_width<'ctx>(
env: &Env<'_, 'ctx, '_>,
int_width: IntWidth,
) -> IntType<'ctx> {
use IntWidth::*;
@ -200,8 +200,8 @@ pub fn int_type_from_int_width<'a, 'ctx, 'env>(
}
}
pub fn float_type_from_float_width<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn float_type_from_float_width<'ctx>(
env: &Env<'_, 'ctx, '_>,
float_width: FloatWidth,
) -> FloatType<'ctx> {
use FloatWidth::*;
@ -431,27 +431,27 @@ pub fn str_list_int(ctx: &Context, target_info: TargetInfo) -> IntType<'_> {
}
}
pub fn zig_list_type<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> StructType<'ctx> {
pub fn zig_list_type<'ctx>(env: &Env<'_, 'ctx, '_>) -> StructType<'ctx> {
env.module.get_struct_type("list.RocList").unwrap()
}
pub fn zig_str_type<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> StructType<'ctx> {
pub fn zig_str_type<'ctx>(env: &Env<'_, 'ctx, '_>) -> StructType<'ctx> {
env.module.get_struct_type("str.RocStr").unwrap()
}
pub fn zig_dec_type<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> StructType<'ctx> {
pub fn zig_dec_type<'ctx>(env: &Env<'_, 'ctx, '_>) -> StructType<'ctx> {
env.module.get_struct_type("dec.RocDec").unwrap()
}
pub fn zig_has_tag_id_type<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> StructType<'ctx> {
pub fn zig_has_tag_id_type<'ctx>(env: &Env<'_, 'ctx, '_>) -> StructType<'ctx> {
let u8_ptr_t = env.context.i8_type().ptr_type(AddressSpace::default());
env.context
.struct_type(&[env.context.bool_type().into(), u8_ptr_t.into()], false)
}
pub fn zig_num_parse_result_type<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn zig_num_parse_result_type<'ctx>(
env: &Env<'_, 'ctx, '_>,
type_name: &str,
) -> StructType<'ctx> {
let name = format!("num.NumParseResult({type_name})");
@ -462,8 +462,8 @@ pub fn zig_num_parse_result_type<'a, 'ctx, 'env>(
}
}
pub fn zig_to_int_checked_result_type<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn zig_to_int_checked_result_type<'ctx>(
env: &Env<'_, 'ctx, '_>,
type_name: &str,
) -> StructType<'ctx> {
let name = format!("num.ToIntCheckedResult({type_name})");
@ -474,7 +474,7 @@ pub fn zig_to_int_checked_result_type<'a, 'ctx, 'env>(
}
}
pub fn zig_with_overflow_roc_dec<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> StructType<'ctx> {
pub fn zig_with_overflow_roc_dec<'ctx>(env: &Env<'_, 'ctx, '_>) -> StructType<'ctx> {
env.module
.get_struct_type("utils.WithOverflow(dec.RocDec)")
.unwrap()