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

@ -487,9 +487,9 @@ impl<'a> Env<'a> {
}
}
fn apply_refcount_operation<'a>(
fn apply_refcount_operation(
builder: &mut FuncDefBuilder,
env: &mut Env<'a>,
env: &mut Env<'_>,
block: BlockId,
modify_rc: &ModifyRc,
) -> Result<()> {

View file

@ -1100,7 +1100,7 @@ fn link_linux(
// Keep NIX_ env vars
.envs(
env::vars()
.filter(|&(ref k, _)| k.starts_with("NIX_"))
.filter(|(k, _)| k.starts_with("NIX_"))
.collect::<HashMap<String, String>>(),
)
.args([

View file

@ -1134,7 +1134,7 @@ fn canonicalize_has_clause(
}
#[allow(clippy::too_many_arguments)]
fn can_extension_type<'a>(
fn can_extension_type(
env: &mut Env,
pol: CanPolarity,
scope: &mut Scope,
@ -1142,7 +1142,7 @@ fn can_extension_type<'a>(
introduced_variables: &mut IntroducedVariables,
local_aliases: &mut VecMap<Symbol, Alias>,
references: &mut VecSet<Symbol>,
opt_ext: &Option<&Loc<TypeAnnotation<'a>>>,
opt_ext: &Option<&Loc<TypeAnnotation<'_>>>,
ext_problem_kind: roc_problem::can::ExtensionTypeKind,
) -> (Type, ExtImplicitOpenness) {
fn valid_record_ext_type(typ: &Type) -> bool {
@ -1451,10 +1451,10 @@ fn can_assigned_fields<'a>(
// TODO trim down these arguments!
#[allow(clippy::too_many_arguments)]
fn can_assigned_tuple_elems<'a>(
fn can_assigned_tuple_elems(
env: &mut Env,
pol: CanPolarity,
elems: &&[Loc<TypeAnnotation<'a>>],
elems: &&[Loc<TypeAnnotation<'_>>],
scope: &mut Scope,
var_store: &mut VarStore,
introduced_variables: &mut IntroducedVariables,

View file

@ -1051,7 +1051,6 @@ fn canonicalize_value_defs<'a>(
for (def_index, pending_def) in pending_value_defs.iter().enumerate() {
let mut new_bindings = BindingsFromPattern::new(pending_def.loc_pattern())
.into_iter()
.peekable();
if new_bindings.peek().is_none() {
@ -1339,8 +1338,8 @@ fn canonicalize_type_defs<'a>(
/// Resolve all pending abilities, to add them to scope.
#[allow(clippy::too_many_arguments)]
fn resolve_abilities<'a>(
env: &mut Env<'a>,
fn resolve_abilities(
env: &mut Env<'_>,
output: &mut Output,
var_store: &mut VarStore,
scope: &mut Scope,
@ -2813,8 +2812,8 @@ fn to_pending_value_def<'a>(
}
/// Make aliases recursive
fn correct_mutual_recursive_type_alias<'a>(
env: &mut Env<'a>,
fn correct_mutual_recursive_type_alias(
env: &mut Env<'_>,
original_aliases: VecMap<Symbol, Alias>,
var_store: &mut VarStore,
) -> VecMap<Symbol, Alias> {
@ -3022,8 +3021,8 @@ fn correct_mutual_recursive_type_alias<'a>(
unsafe { VecMap::zip(symbols_introduced, aliases) }
}
fn make_tag_union_of_alias_recursive<'a>(
env: &mut Env<'a>,
fn make_tag_union_of_alias_recursive(
env: &mut Env<'_>,
alias_name: Symbol,
alias: &mut Alias,
others: Vec<Symbol>,
@ -3215,8 +3214,8 @@ fn make_tag_union_recursive_help<'a, 'b>(
}
}
fn mark_cyclic_alias<'a>(
env: &mut Env<'a>,
fn mark_cyclic_alias(
env: &mut Env<'_>,
typ: &mut Type,
symbol: Symbol,
alias_kind: AliasKind,

View file

@ -195,11 +195,11 @@ enum GeneratedInfo {
}
impl GeneratedInfo {
fn from_header_type<'a>(
fn from_header_type(
env: &mut Env,
scope: &mut Scope,
var_store: &mut VarStore,
header_type: &HeaderType<'a>,
header_type: &HeaderType<'_>,
) -> Self {
match header_type {
HeaderType::Hosted {

View file

@ -321,8 +321,8 @@ pub fn canonicalize_def_header_pattern<'a>(
#[derive(PartialEq, Eq, Clone, Copy)]
pub struct PermitShadows(pub bool);
fn canonicalize_pattern_symbol<'a>(
env: &mut Env<'a>,
fn canonicalize_pattern_symbol(
env: &mut Env<'_>,
scope: &mut Scope,
output: &mut Output,
region: Region,

View file

@ -122,7 +122,7 @@ pub fn walk_decls<V: Visitor>(visitor: &mut V, decls: &Declarations) {
None => Pattern::Identifier(loc_symbol.value),
};
let function_def = &decls.function_bodies[function_index.index() as usize];
let function_def = &decls.function_bodies[function_index.index()];
DeclarationInfo::Function {
loc_symbol,
@ -133,7 +133,7 @@ pub fn walk_decls<V: Visitor>(visitor: &mut V, decls: &Declarations) {
}
}
Destructure(destructure_index) => {
let destructure = &decls.destructs[destructure_index.index() as usize];
let destructure = &decls.destructs[destructure_index.index()];
let loc_pattern = &destructure.loc_pattern;
let loc_expr = &decls.expressions[index];

View file

@ -2600,7 +2600,7 @@ pub fn constrain_decls(
cycle_mark,
);
index += length as usize;
index += length;
}
}

View file

@ -55,7 +55,6 @@ pub(crate) fn derive_to_encoder(
// Generalized tuple var so we can reuse this impl between many tuples:
// if arity = n, this is (t1, ..., tn) for fresh t1, ..., tn.
let flex_elems = (0..arity)
.into_iter()
.map(|idx| (idx as usize, env.subs.fresh_unnamed_flex_var()))
.collect::<Vec<_>>();
let elems = TupleElems::insert_into_subs(env.subs, flex_elems);

View file

@ -131,7 +131,6 @@ fn hash_tuple(env: &mut Env<'_>, fn_name: Symbol, arity: u32) -> (Variable, Expr
// TODO: avoid an allocation here by pre-allocating the indices and variables `TupleElems`
// will be instantiated with.
let flex_elems: Vec<_> = (0..arity)
.into_iter()
.map(|i| (i as usize, env.subs.fresh_unnamed_flex_var()))
.collect();
let elems = TupleElems::insert_into_subs(env.subs, flex_elems);

View file

@ -65,15 +65,15 @@ impl Newlines {
pub trait Formattable {
fn is_multiline(&self) -> bool;
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
_newlines: Newlines,
indent: u16,
);
fn format<'buf>(&self, buf: &mut Buf<'buf>, indent: u16) {
fn format(&self, buf: &mut Buf<'_>, indent: u16) {
self.format_with_options(buf, Parens::NotNeeded, Newlines::No, indent);
}
}
@ -87,9 +87,9 @@ where
(*self).is_multiline()
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
parens: Parens,
newlines: Newlines,
indent: u16,
@ -97,7 +97,7 @@ where
(*self).format_with_options(buf, parens, newlines, indent)
}
fn format<'buf>(&self, buf: &mut Buf<'buf>, indent: u16) {
fn format(&self, buf: &mut Buf<'_>, indent: u16) {
(*self).format(buf, indent)
}
}
@ -120,9 +120,9 @@ where
self.value.is_multiline()
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
parens: Parens,
newlines: Newlines,
indent: u16,
@ -131,7 +131,7 @@ where
.format_with_options(buf, parens, newlines, indent)
}
fn format<'buf>(&self, buf: &mut Buf<'buf>, indent: u16) {
fn format(&self, buf: &mut Buf<'_>, indent: u16) {
self.value.format(buf, indent)
}
}
@ -141,9 +141,9 @@ impl<'a> Formattable for UppercaseIdent<'a> {
false
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
_newlines: Newlines,
_indent: u16,
@ -206,9 +206,9 @@ impl<'a> Formattable for TypeAnnotation<'a> {
}
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
parens: Parens,
newlines: Newlines,
indent: u16,
@ -424,9 +424,9 @@ impl<'a> Formattable for AssignedField<'a, TypeAnnotation<'a>> {
is_multiline_assigned_field_help(self)
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
newlines: Newlines,
indent: u16,
@ -441,9 +441,9 @@ impl<'a> Formattable for AssignedField<'a, Expr<'a>> {
is_multiline_assigned_field_help(self)
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
newlines: Newlines,
indent: u16,
@ -466,9 +466,9 @@ fn is_multiline_assigned_field_help<T: Formattable>(afield: &AssignedField<'_, T
}
}
fn format_assigned_field_help<'a, 'buf, T>(
zelf: &AssignedField<'a, T>,
buf: &mut Buf<'buf>,
fn format_assigned_field_help<T>(
zelf: &AssignedField<'_, T>,
buf: &mut Buf<'_>,
indent: u16,
separator_spaces: usize,
is_multiline: bool,
@ -545,9 +545,9 @@ impl<'a> Formattable for Tag<'a> {
}
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
_newlines: Newlines,
indent: u16,
@ -592,9 +592,9 @@ impl<'a> Formattable for HasClause<'a> {
false
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
parens: Parens,
newlines: Newlines,
indent: u16,
@ -623,9 +623,9 @@ impl<'a> Formattable for HasImpls<'a> {
}
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
parens: Parens,
newlines: Newlines,
indent: u16,
@ -662,9 +662,9 @@ impl<'a> Formattable for HasAbility<'a> {
}
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
parens: Parens,
newlines: Newlines,
indent: u16,
@ -703,9 +703,9 @@ impl<'a> Formattable for HasAbilities<'a> {
}
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
parens: Parens,
newlines: Newlines,
indent: u16,

View file

@ -15,9 +15,9 @@ impl<'a> Formattable for Defs<'a> {
!self.tags.is_empty()
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
_newlines: Newlines,
indent: u16,
@ -57,9 +57,9 @@ impl<'a> Formattable for TypeDef<'a> {
}
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
newlines: Newlines,
indent: u16,
@ -171,9 +171,9 @@ impl<'a> Formattable for TypeHeader<'a> {
self.vars.iter().any(|v| v.is_multiline())
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
_newlines: Newlines,
indent: u16,
@ -205,9 +205,9 @@ impl<'a> Formattable for ValueDef<'a> {
}
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
newlines: Newlines,
indent: u16,
@ -314,8 +314,8 @@ fn should_outdent(mut rhs: &TypeAnnotation) -> bool {
}
}
fn fmt_dbg_in_def<'a, 'buf>(
buf: &mut Buf<'buf>,
fn fmt_dbg_in_def<'a>(
buf: &mut Buf<'_>,
condition: &'a Loc<Expr<'a>>,
is_multiline: bool,
indent: u16,
@ -335,8 +335,8 @@ fn fmt_dbg_in_def<'a, 'buf>(
condition.format(buf, return_indent);
}
fn fmt_expect<'a, 'buf>(
buf: &mut Buf<'buf>,
fn fmt_expect<'a>(
buf: &mut Buf<'_>,
condition: &'a Loc<Expr<'a>>,
is_multiline: bool,
indent: u16,
@ -356,8 +356,8 @@ fn fmt_expect<'a, 'buf>(
condition.format(buf, return_indent);
}
fn fmt_expect_fx<'a, 'buf>(
buf: &mut Buf<'buf>,
fn fmt_expect_fx<'a>(
buf: &mut Buf<'_>,
condition: &'a Loc<Expr<'a>>,
is_multiline: bool,
indent: u16,
@ -377,24 +377,24 @@ fn fmt_expect_fx<'a, 'buf>(
condition.format(buf, return_indent);
}
pub fn fmt_value_def<'a, 'buf>(
buf: &mut Buf<'buf>,
def: &roc_parse::ast::ValueDef<'a>,
pub fn fmt_value_def(
buf: &mut Buf<'_>,
def: &roc_parse::ast::ValueDef<'_>,
indent: u16,
) {
def.format(buf, indent);
}
pub fn fmt_type_def<'a, 'buf>(buf: &mut Buf<'buf>, def: &roc_parse::ast::TypeDef<'a>, indent: u16) {
pub fn fmt_type_def(buf: &mut Buf<'_>, def: &roc_parse::ast::TypeDef<'_>, indent: u16) {
def.format(buf, indent);
}
pub fn fmt_defs<'a, 'buf>(buf: &mut Buf<'buf>, defs: &Defs<'a>, indent: u16) {
pub fn fmt_defs(buf: &mut Buf<'_>, defs: &Defs<'_>, indent: u16) {
defs.format(buf, indent);
}
pub fn fmt_body<'a, 'buf>(
buf: &mut Buf<'buf>,
pub fn fmt_body<'a>(
buf: &mut Buf<'_>,
pattern: &'a Pattern<'a>,
body: &'a Expr<'a>,
indent: u16,
@ -462,9 +462,9 @@ impl<'a> Formattable for AbilityMember<'a> {
self.name.value.is_multiline() || self.typ.is_multiline()
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
_newlines: Newlines,
indent: u16,

View file

@ -103,9 +103,9 @@ impl<'a> Formattable for Expr<'a> {
}
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
parens: Parens,
newlines: Newlines,
indent: u16,
@ -551,7 +551,7 @@ fn starts_with_newline(expr: &Expr) -> bool {
}
}
fn format_str_segment<'a, 'buf>(seg: &StrSegment<'a>, buf: &mut Buf<'buf>, indent: u16) {
fn format_str_segment(seg: &StrSegment<'_>, buf: &mut Buf<'_>, indent: u16) {
use StrSegment::*;
match seg {
@ -614,7 +614,7 @@ fn push_op(buf: &mut Buf, op: BinOp) {
}
}
pub fn fmt_str_literal<'buf>(buf: &mut Buf<'buf>, literal: StrLiteral, indent: u16) {
pub fn fmt_str_literal(buf: &mut Buf<'_>, literal: StrLiteral, indent: u16) {
use roc_parse::ast::StrLiteral::*;
match literal {
@ -673,8 +673,8 @@ pub fn fmt_str_literal<'buf>(buf: &mut Buf<'buf>, literal: StrLiteral, indent: u
}
}
fn fmt_binops<'a, 'buf>(
buf: &mut Buf<'buf>,
fn fmt_binops<'a>(
buf: &mut Buf<'_>,
lefts: &'a [(Loc<Expr<'a>>, Loc<BinOp>)],
loc_right_side: &'a Loc<Expr<'a>>,
part_of_multi_line_binops: bool,
@ -704,9 +704,9 @@ fn fmt_binops<'a, 'buf>(
loc_right_side.format_with_options(buf, Parens::InOperator, Newlines::Yes, indent);
}
fn format_spaces<'a, 'buf>(
buf: &mut Buf<'buf>,
spaces: &[CommentOrNewline<'a>],
fn format_spaces(
buf: &mut Buf<'_>,
spaces: &[CommentOrNewline<'_>],
newlines: Newlines,
indent: u16,
) {
@ -738,8 +738,8 @@ fn is_when_patterns_multiline(when_branch: &WhenBranch) -> bool {
is_multiline_patterns
}
fn fmt_when<'a, 'buf>(
buf: &mut Buf<'buf>,
fn fmt_when<'a>(
buf: &mut Buf<'_>,
loc_condition: &'a Loc<Expr<'a>>,
branches: &[&'a WhenBranch<'a>],
indent: u16,
@ -920,8 +920,8 @@ fn fmt_when<'a, 'buf>(
}
}
fn fmt_dbg<'a, 'buf>(
buf: &mut Buf<'buf>,
fn fmt_dbg<'a>(
buf: &mut Buf<'_>,
condition: &'a Loc<Expr<'a>>,
continuation: &'a Loc<Expr<'a>>,
is_multiline: bool,
@ -947,8 +947,8 @@ fn fmt_dbg<'a, 'buf>(
continuation.format(buf, indent);
}
fn fmt_expect<'a, 'buf>(
buf: &mut Buf<'buf>,
fn fmt_expect<'a>(
buf: &mut Buf<'_>,
condition: &'a Loc<Expr<'a>>,
continuation: &'a Loc<Expr<'a>>,
is_multiline: bool,
@ -974,8 +974,8 @@ fn fmt_expect<'a, 'buf>(
continuation.format(buf, indent);
}
fn fmt_if<'a, 'buf>(
buf: &mut Buf<'buf>,
fn fmt_if<'a>(
buf: &mut Buf<'_>,
branches: &'a [(Loc<Expr<'a>>, Loc<Expr<'a>>)],
final_else: &'a Loc<Expr<'a>>,
is_multiline: bool,
@ -1123,8 +1123,8 @@ fn fmt_if<'a, 'buf>(
final_else.format(buf, return_indent);
}
fn fmt_closure<'a, 'buf>(
buf: &mut Buf<'buf>,
fn fmt_closure<'a>(
buf: &mut Buf<'_>,
loc_patterns: &'a [Loc<Pattern<'a>>],
loc_ret: &'a Loc<Expr<'a>>,
indent: u16,
@ -1224,8 +1224,8 @@ fn fmt_closure<'a, 'buf>(
}
}
fn fmt_backpassing<'a, 'buf>(
buf: &mut Buf<'buf>,
fn fmt_backpassing<'a>(
buf: &mut Buf<'_>,
loc_patterns: &'a [Loc<Pattern<'a>>],
loc_body: &'a Loc<Expr<'a>>,
loc_ret: &'a Loc<Expr<'a>>,
@ -1312,8 +1312,8 @@ fn pattern_needs_parens_when_backpassing(pat: &Pattern) -> bool {
}
}
fn fmt_record<'a, 'buf>(
buf: &mut Buf<'buf>,
fn fmt_record<'a>(
buf: &mut Buf<'_>,
update: Option<&'a Loc<Expr<'a>>>,
fields: Collection<'a, Loc<AssignedField<'a, Expr<'a>>>>,
indent: u16,
@ -1404,9 +1404,9 @@ fn fmt_record<'a, 'buf>(
}
}
fn format_field_multiline<'a, 'buf, T>(
buf: &mut Buf<'buf>,
field: &AssignedField<'a, T>,
fn format_field_multiline<T>(
buf: &mut Buf<'_>,
field: &AssignedField<'_, T>,
indent: u16,
separator_prefix: &str,
) where

View file

@ -44,9 +44,9 @@ macro_rules! keywords {
false
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: crate::annotation::Parens,
_newlines: Newlines,
indent: u16,
@ -86,9 +86,9 @@ impl<V: Formattable> Formattable for Option<V> {
}
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
parens: crate::annotation::Parens,
newlines: Newlines,
indent: u16,
@ -111,9 +111,9 @@ impl<'a> Formattable for ProvidesTo<'a> {
|| self.to_keyword.is_multiline()
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: crate::annotation::Parens,
_newlines: Newlines,
indent: u16,
@ -130,9 +130,9 @@ impl<'a> Formattable for PlatformRequires<'a> {
is_collection_multiline(&self.rigids) || self.signature.is_multiline()
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: crate::annotation::Parens,
_newlines: Newlines,
indent: u16,
@ -146,9 +146,9 @@ impl<'a, V: Formattable> Formattable for Spaces<'a, V> {
!self.before.is_empty() || !self.after.is_empty() || self.item.is_multiline()
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
parens: crate::annotation::Parens,
newlines: Newlines,
indent: u16,
@ -164,9 +164,9 @@ impl<'a, K: Formattable, V: Formattable> Formattable for KeywordItem<'a, K, V> {
self.keyword.is_multiline() || self.item.is_multiline()
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
parens: Parens,
newlines: Newlines,
indent: u16,
@ -177,7 +177,7 @@ impl<'a, K: Formattable, V: Formattable> Formattable for KeywordItem<'a, K, V> {
}
}
pub fn fmt_interface_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a InterfaceHeader<'a>) {
pub fn fmt_interface_header<'a>(buf: &mut Buf<'_>, header: &'a InterfaceHeader<'a>) {
buf.indent(0);
buf.push_str("interface");
let indent = INDENT;
@ -193,7 +193,7 @@ pub fn fmt_interface_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a Interface
fmt_imports(buf, header.imports.item, indent);
}
pub fn fmt_hosted_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a HostedHeader<'a>) {
pub fn fmt_hosted_header<'a>(buf: &mut Buf<'_>, header: &'a HostedHeader<'a>) {
buf.indent(0);
buf.push_str("hosted");
let indent = INDENT;
@ -210,7 +210,7 @@ pub fn fmt_hosted_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a HostedHeader
fmt_exposes(buf, header.generates_with.item, indent);
}
pub fn fmt_app_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a AppHeader<'a>) {
pub fn fmt_app_header<'a>(buf: &mut Buf<'_>, header: &'a AppHeader<'a>) {
buf.indent(0);
buf.push_str("app");
let indent = INDENT;
@ -229,7 +229,7 @@ pub fn fmt_app_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a AppHeader<'a>)
header.provides.format(buf, indent);
}
pub fn fmt_package_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a PackageHeader<'a>) {
pub fn fmt_package_header<'a>(buf: &mut Buf<'_>, header: &'a PackageHeader<'a>) {
buf.indent(0);
buf.push_str("package");
let indent = INDENT;
@ -243,7 +243,7 @@ pub fn fmt_package_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a PackageHead
fmt_packages(buf, header.packages.item, indent);
}
pub fn fmt_platform_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a PlatformHeader<'a>) {
pub fn fmt_platform_header<'a>(buf: &mut Buf<'_>, header: &'a PlatformHeader<'a>) {
buf.indent(0);
buf.push_str("platform");
let indent = INDENT;
@ -262,7 +262,7 @@ pub fn fmt_platform_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a PlatformHe
fmt_provides(buf, header.provides.item, None, indent);
}
fn fmt_requires<'a, 'buf>(buf: &mut Buf<'buf>, requires: &PlatformRequires<'a>, indent: u16) {
fn fmt_requires(buf: &mut Buf<'_>, requires: &PlatformRequires<'_>, indent: u16) {
fmt_collection(buf, indent, Braces::Curly, requires.rigids, Newlines::No);
buf.push_str(" {");
@ -276,9 +276,9 @@ impl<'a> Formattable for TypedIdent<'a> {
false
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
_newlines: Newlines,
indent: u16,
@ -293,7 +293,7 @@ impl<'a> Formattable for TypedIdent<'a> {
}
}
fn fmt_package_name<'buf>(buf: &mut Buf<'buf>, name: PackageName, indent: u16) {
fn fmt_package_name(buf: &mut Buf<'_>, name: PackageName, indent: u16) {
buf.indent(indent);
buf.push('"');
buf.push_str_allow_spaces(name.to_str());
@ -312,9 +312,9 @@ impl<'a, T: Formattable> Formattable for Spaced<'a, T> {
}
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
parens: crate::annotation::Parens,
newlines: Newlines,
indent: u16,
@ -335,16 +335,16 @@ impl<'a, T: Formattable> Formattable for Spaced<'a, T> {
}
}
fn fmt_imports<'a, 'buf>(
buf: &mut Buf<'buf>,
fn fmt_imports<'a>(
buf: &mut Buf<'_>,
loc_entries: Collection<'a, Loc<Spaced<'a, ImportsEntry<'a>>>>,
indent: u16,
) {
fmt_collection(buf, indent, Braces::Square, loc_entries, Newlines::No)
}
fn fmt_provides<'a, 'buf>(
buf: &mut Buf<'buf>,
fn fmt_provides<'a>(
buf: &mut Buf<'_>,
loc_exposed_names: Collection<'a, Loc<Spaced<'a, ExposedName<'a>>>>,
loc_provided_types: Option<Collection<'a, Loc<Spaced<'a, UppercaseIdent<'a>>>>>,
indent: u16,
@ -356,7 +356,7 @@ fn fmt_provides<'a, 'buf>(
}
}
fn fmt_to<'buf>(buf: &mut Buf<'buf>, to: To, indent: u16) {
fn fmt_to(buf: &mut Buf<'_>, to: To, indent: u16) {
match to {
To::ExistingPackage(name) => {
buf.push_str(name);
@ -365,8 +365,8 @@ fn fmt_to<'buf>(buf: &mut Buf<'buf>, to: To, indent: u16) {
}
}
fn fmt_exposes<'buf, N: Formattable + Copy + core::fmt::Debug>(
buf: &mut Buf<'buf>,
fn fmt_exposes<N: Formattable + Copy + core::fmt::Debug>(
buf: &mut Buf<'_>,
loc_entries: Collection<'_, Loc<Spaced<'_, N>>>,
indent: u16,
) {
@ -374,17 +374,17 @@ fn fmt_exposes<'buf, N: Formattable + Copy + core::fmt::Debug>(
}
pub trait FormatName {
fn format<'buf>(&self, buf: &mut Buf<'buf>);
fn format(&self, buf: &mut Buf<'_>);
}
impl<'a> FormatName for &'a str {
fn format<'buf>(&self, buf: &mut Buf<'buf>) {
fn format(&self, buf: &mut Buf<'_>) {
buf.push_str(self)
}
}
impl<'a> FormatName for ModuleName<'a> {
fn format<'buf>(&self, buf: &mut Buf<'buf>) {
fn format(&self, buf: &mut Buf<'_>) {
buf.push_str(self.as_str());
}
}
@ -394,9 +394,9 @@ impl<'a> Formattable for ModuleName<'a> {
false
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
_newlines: Newlines,
_indent: u16,
@ -410,9 +410,9 @@ impl<'a> Formattable for ExposedName<'a> {
false
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
_newlines: Newlines,
indent: u16,
@ -423,13 +423,13 @@ impl<'a> Formattable for ExposedName<'a> {
}
impl<'a> FormatName for ExposedName<'a> {
fn format<'buf>(&self, buf: &mut Buf<'buf>) {
fn format(&self, buf: &mut Buf<'_>) {
buf.push_str(self.as_str());
}
}
fn fmt_packages<'a, 'buf>(
buf: &mut Buf<'buf>,
fn fmt_packages<'a>(
buf: &mut Buf<'_>,
loc_entries: Collection<'a, Loc<Spaced<'a, PackageEntry<'a>>>>,
indent: u16,
) {
@ -441,9 +441,9 @@ impl<'a> Formattable for PackageEntry<'a> {
false
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
_newlines: Newlines,
indent: u16,
@ -457,9 +457,9 @@ impl<'a> Formattable for ImportsEntry<'a> {
false
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
_newlines: Newlines,
indent: u16,
@ -467,14 +467,14 @@ impl<'a> Formattable for ImportsEntry<'a> {
fmt_imports_entry(buf, self, indent);
}
}
fn fmt_packages_entry<'a, 'buf>(buf: &mut Buf<'buf>, entry: &PackageEntry<'a>, indent: u16) {
fn fmt_packages_entry(buf: &mut Buf<'_>, entry: &PackageEntry<'_>, indent: u16) {
buf.push_str(entry.shorthand);
buf.push(':');
fmt_default_spaces(buf, entry.spaces_after_shorthand, indent);
fmt_package_name(buf, entry.package_name.value, indent);
}
fn fmt_imports_entry<'a, 'buf>(buf: &mut Buf<'buf>, entry: &ImportsEntry<'a>, indent: u16) {
fn fmt_imports_entry(buf: &mut Buf<'_>, entry: &ImportsEntry<'_>, indent: u16) {
use roc_parse::header::ImportsEntry::*;
buf.indent(indent);

View file

@ -4,8 +4,8 @@ use crate::spaces::{fmt_comments_only, fmt_spaces, NewlineAt, INDENT};
use crate::Buf;
use roc_parse::ast::{Base, CommentOrNewline, Pattern, PatternAs};
pub fn fmt_pattern<'a, 'buf>(
buf: &mut Buf<'buf>,
pub fn fmt_pattern<'a>(
buf: &mut Buf<'_>,
pattern: &'a Pattern<'a>,
indent: u16,
parens: Parens,
@ -18,9 +18,9 @@ impl<'a> Formattable for PatternAs<'a> {
self.spaces_before.iter().any(|s| s.is_comment())
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
_parens: Parens,
_newlines: Newlines,
indent: u16,
@ -85,9 +85,9 @@ impl<'a> Formattable for Pattern<'a> {
}
}
fn format_with_options<'buf>(
fn format_with_options(
&self,
buf: &mut Buf<'buf>,
buf: &mut Buf<'_>,
parens: Parens,
newlines: Newlines,
indent: u16,

View file

@ -21,9 +21,9 @@ use crate::{Ast, Buf};
/// The number of spaces to indent.
pub const INDENT: u16 = 4;
pub fn fmt_default_spaces<'a, 'buf>(
buf: &mut Buf<'buf>,
spaces: &[CommentOrNewline<'a>],
pub fn fmt_default_spaces(
buf: &mut Buf<'_>,
spaces: &[CommentOrNewline<'_>],
indent: u16,
) {
if spaces.is_empty() {
@ -32,9 +32,9 @@ pub fn fmt_default_spaces<'a, 'buf>(
fmt_spaces(buf, spaces.iter(), indent);
}
}
pub fn fmt_default_newline<'a, 'buf>(
buf: &mut Buf<'buf>,
spaces: &[CommentOrNewline<'a>],
pub fn fmt_default_newline(
buf: &mut Buf<'_>,
spaces: &[CommentOrNewline<'_>],
indent: u16,
) {
if spaces.is_empty() {
@ -153,7 +153,7 @@ pub fn fmt_comments_only<'a, 'buf, I>(
}
}
fn fmt_comment<'buf>(buf: &mut Buf<'buf>, comment: &str) {
fn fmt_comment(buf: &mut Buf<'_>, comment: &str) {
// The '#' in a comment should always be preceded by a newline or a space,
// unless it's the very beginning of the buffer.
if !buf.is_empty() && !buf.ends_with_space() && !buf.ends_with_newline() {
@ -192,7 +192,7 @@ where
count
}
fn fmt_docs<'buf>(buf: &mut Buf<'buf>, docs: &str) {
fn fmt_docs(buf: &mut Buf<'_>, docs: &str) {
// The "##" in a doc comment should always be preceded by a newline or a space,
// unless it's the very beginning of the buffer.
if !buf.is_empty() && !buf.ends_with_space() && !buf.ends_with_newline() {

View file

@ -385,11 +385,11 @@ impl CallConv<AArch64GeneralReg, AArch64FloatReg, AArch64Assembler> for AArch64C
}
#[inline(always)]
fn load_args<'a, 'r>(
fn load_args<'a>(
_buf: &mut Vec<'a, u8>,
_storage_manager: &mut StorageManager<
'a,
'r,
'_,
AArch64GeneralReg,
AArch64FloatReg,
AArch64Assembler,
@ -403,11 +403,11 @@ impl CallConv<AArch64GeneralReg, AArch64FloatReg, AArch64Assembler> for AArch64C
}
#[inline(always)]
fn store_args<'a, 'r>(
fn store_args<'a>(
_buf: &mut Vec<'a, u8>,
_storage_manager: &mut StorageManager<
'a,
'r,
'_,
AArch64GeneralReg,
AArch64FloatReg,
AArch64Assembler,
@ -422,11 +422,11 @@ impl CallConv<AArch64GeneralReg, AArch64FloatReg, AArch64Assembler> for AArch64C
todo!("Storing args for AArch64");
}
fn return_complex_symbol<'a, 'r>(
fn return_complex_symbol<'a>(
_buf: &mut Vec<'a, u8>,
_storage_manager: &mut StorageManager<
'a,
'r,
'_,
AArch64GeneralReg,
AArch64FloatReg,
AArch64Assembler,
@ -439,11 +439,11 @@ impl CallConv<AArch64GeneralReg, AArch64FloatReg, AArch64Assembler> for AArch64C
todo!("Returning complex symbols for AArch64");
}
fn load_returned_complex_symbol<'a, 'r>(
fn load_returned_complex_symbol<'a>(
_buf: &mut Vec<'a, u8>,
_storage_manager: &mut StorageManager<
'a,
'r,
'_,
AArch64GeneralReg,
AArch64FloatReg,
AArch64Assembler,
@ -532,9 +532,9 @@ impl Assembler<AArch64GeneralReg, AArch64FloatReg> for AArch64Assembler {
mul_reg64_reg64_reg64(buf, dst, src1, src2);
}
fn umul_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn umul_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
_storage_manager: &mut StorageManager<'a, 'r, AArch64GeneralReg, AArch64FloatReg, ASM, CC>,
_storage_manager: &mut StorageManager<'a, '_, AArch64GeneralReg, AArch64FloatReg, ASM, CC>,
dst: AArch64GeneralReg,
src1: AArch64GeneralReg,
src2: AArch64GeneralReg,
@ -545,9 +545,9 @@ impl Assembler<AArch64GeneralReg, AArch64FloatReg> for AArch64Assembler {
mul_reg64_reg64_reg64(buf, dst, src1, src2);
}
fn idiv_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn idiv_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
_storage_manager: &mut StorageManager<'a, 'r, AArch64GeneralReg, AArch64FloatReg, ASM, CC>,
_storage_manager: &mut StorageManager<'a, '_, AArch64GeneralReg, AArch64FloatReg, ASM, CC>,
dst: AArch64GeneralReg,
src1: AArch64GeneralReg,
src2: AArch64GeneralReg,
@ -558,9 +558,9 @@ impl Assembler<AArch64GeneralReg, AArch64FloatReg> for AArch64Assembler {
sdiv_reg64_reg64_reg64(buf, dst, src1, src2);
}
fn udiv_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn udiv_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
_storage_manager: &mut StorageManager<'a, 'r, AArch64GeneralReg, AArch64FloatReg, ASM, CC>,
_storage_manager: &mut StorageManager<'a, '_, AArch64GeneralReg, AArch64FloatReg, ASM, CC>,
dst: AArch64GeneralReg,
src1: AArch64GeneralReg,
src2: AArch64GeneralReg,
@ -1096,9 +1096,9 @@ impl Assembler<AArch64GeneralReg, AArch64FloatReg> for AArch64Assembler {
eor_reg64_reg64_reg64(buf, dst, src1, src2);
}
fn shl_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn shl_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
_storage_manager: &mut StorageManager<'a, 'r, AArch64GeneralReg, AArch64FloatReg, ASM, CC>,
_storage_manager: &mut StorageManager<'a, '_, AArch64GeneralReg, AArch64FloatReg, ASM, CC>,
dst: AArch64GeneralReg,
src1: AArch64GeneralReg,
src2: AArch64GeneralReg,
@ -1109,9 +1109,9 @@ impl Assembler<AArch64GeneralReg, AArch64FloatReg> for AArch64Assembler {
lsl_reg64_reg64_reg64(buf, dst, src1, src2);
}
fn shr_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn shr_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
_storage_manager: &mut StorageManager<'a, 'r, AArch64GeneralReg, AArch64FloatReg, ASM, CC>,
_storage_manager: &mut StorageManager<'a, '_, AArch64GeneralReg, AArch64FloatReg, ASM, CC>,
dst: AArch64GeneralReg,
src1: AArch64GeneralReg,
src2: AArch64GeneralReg,
@ -1122,9 +1122,9 @@ impl Assembler<AArch64GeneralReg, AArch64FloatReg> for AArch64Assembler {
lsr_reg64_reg64_reg64(buf, dst, src1, src2);
}
fn sar_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn sar_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
_storage_manager: &mut StorageManager<'a, 'r, AArch64GeneralReg, AArch64FloatReg, ASM, CC>,
_storage_manager: &mut StorageManager<'a, '_, AArch64GeneralReg, AArch64FloatReg, ASM, CC>,
dst: AArch64GeneralReg,
src1: AArch64GeneralReg,
src2: AArch64GeneralReg,

View file

@ -62,15 +62,15 @@ pub trait CallConv<GeneralReg: RegTrait, FloatReg: RegTrait, ASM: Assembler<Gene
!Self::float_callee_saved(reg)
}
fn setup_stack<'a>(
buf: &mut Vec<'a, u8>,
fn setup_stack(
buf: &mut Vec<'_, u8>,
general_saved_regs: &[GeneralReg],
float_saved_regs: &[FloatReg],
requested_stack_size: i32,
fn_call_stack_size: i32,
) -> i32;
fn cleanup_stack<'a>(
buf: &mut Vec<'a, u8>,
fn cleanup_stack(
buf: &mut Vec<'_, u8>,
general_saved_regs: &[GeneralReg],
float_saved_regs: &[FloatReg],
aligned_stack_size: i32,
@ -78,9 +78,9 @@ pub trait CallConv<GeneralReg: RegTrait, FloatReg: RegTrait, ASM: Assembler<Gene
);
/// load_args updates the storage manager to know where every arg is stored.
fn load_args<'a, 'r>(
fn load_args<'a>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, GeneralReg, FloatReg, ASM, Self>,
storage_manager: &mut StorageManager<'a, '_, GeneralReg, FloatReg, ASM, Self>,
layout_interner: &mut STLayoutInterner<'a>,
args: &'a [(InLayout<'a>, Symbol)],
// ret_layout is needed because if it is a complex type, we pass a pointer as the first arg.
@ -89,9 +89,9 @@ pub trait CallConv<GeneralReg: RegTrait, FloatReg: RegTrait, ASM: Assembler<Gene
/// store_args stores the args in registers and on the stack for function calling.
/// It also updates the amount of temporary stack space needed in the storage manager.
fn store_args<'a, 'r>(
fn store_args<'a>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, GeneralReg, FloatReg, ASM, Self>,
storage_manager: &mut StorageManager<'a, '_, GeneralReg, FloatReg, ASM, Self>,
layout_interner: &mut STLayoutInterner<'a>,
dst: &Symbol,
args: &[Symbol],
@ -102,9 +102,9 @@ pub trait CallConv<GeneralReg: RegTrait, FloatReg: RegTrait, ASM: Assembler<Gene
/// return_complex_symbol returns the specified complex/non-primative symbol.
/// It uses the layout to determine how the data should be returned.
fn return_complex_symbol<'a, 'r>(
fn return_complex_symbol<'a>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, GeneralReg, FloatReg, ASM, Self>,
storage_manager: &mut StorageManager<'a, '_, GeneralReg, FloatReg, ASM, Self>,
layout_interner: &mut STLayoutInterner<'a>,
sym: &Symbol,
layout: &InLayout<'a>,
@ -112,9 +112,9 @@ pub trait CallConv<GeneralReg: RegTrait, FloatReg: RegTrait, ASM: Assembler<Gene
/// load_returned_complex_symbol loads a complex symbol that was returned from a function call.
/// It uses the layout to determine how the data should be loaded into the symbol.
fn load_returned_complex_symbol<'a, 'r>(
fn load_returned_complex_symbol<'a>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, GeneralReg, FloatReg, ASM, Self>,
storage_manager: &mut StorageManager<'a, '_, GeneralReg, FloatReg, ASM, Self>,
layout_interner: &mut STLayoutInterner<'a>,
sym: &Symbol,
layout: &InLayout<'a>,
@ -184,9 +184,9 @@ pub trait Assembler<GeneralReg: RegTrait, FloatReg: RegTrait>: Sized + Copy {
src2: GeneralReg,
);
fn shl_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn shl_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, GeneralReg, FloatReg, ASM, CC>,
storage_manager: &mut StorageManager<'a, '_, GeneralReg, FloatReg, ASM, CC>,
dst: GeneralReg,
src1: GeneralReg,
src2: GeneralReg,
@ -194,9 +194,9 @@ pub trait Assembler<GeneralReg: RegTrait, FloatReg: RegTrait>: Sized + Copy {
ASM: Assembler<GeneralReg, FloatReg>,
CC: CallConv<GeneralReg, FloatReg, ASM>;
fn shr_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn shr_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, GeneralReg, FloatReg, ASM, CC>,
storage_manager: &mut StorageManager<'a, '_, GeneralReg, FloatReg, ASM, CC>,
dst: GeneralReg,
src1: GeneralReg,
src2: GeneralReg,
@ -204,9 +204,9 @@ pub trait Assembler<GeneralReg: RegTrait, FloatReg: RegTrait>: Sized + Copy {
ASM: Assembler<GeneralReg, FloatReg>,
CC: CallConv<GeneralReg, FloatReg, ASM>;
fn sar_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn sar_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, GeneralReg, FloatReg, ASM, CC>,
storage_manager: &mut StorageManager<'a, '_, GeneralReg, FloatReg, ASM, CC>,
dst: GeneralReg,
src1: GeneralReg,
src2: GeneralReg,
@ -359,9 +359,9 @@ pub trait Assembler<GeneralReg: RegTrait, FloatReg: RegTrait>: Sized + Copy {
src1: GeneralReg,
src2: GeneralReg,
);
fn umul_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn umul_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, GeneralReg, FloatReg, ASM, CC>,
storage_manager: &mut StorageManager<'a, '_, GeneralReg, FloatReg, ASM, CC>,
dst: GeneralReg,
src1: GeneralReg,
src2: GeneralReg,
@ -369,18 +369,18 @@ pub trait Assembler<GeneralReg: RegTrait, FloatReg: RegTrait>: Sized + Copy {
ASM: Assembler<GeneralReg, FloatReg>,
CC: CallConv<GeneralReg, FloatReg, ASM>;
fn idiv_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn idiv_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, GeneralReg, FloatReg, ASM, CC>,
storage_manager: &mut StorageManager<'a, '_, GeneralReg, FloatReg, ASM, CC>,
dst: GeneralReg,
src1: GeneralReg,
src2: GeneralReg,
) where
ASM: Assembler<GeneralReg, FloatReg>,
CC: CallConv<GeneralReg, FloatReg, ASM>;
fn udiv_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn udiv_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, GeneralReg, FloatReg, ASM, CC>,
storage_manager: &mut StorageManager<'a, '_, GeneralReg, FloatReg, ASM, CC>,
dst: GeneralReg,
src1: GeneralReg,
src2: GeneralReg,
@ -1776,7 +1776,7 @@ impl<
self.storage_manager.with_tmp_general_reg(
&mut self.buf,
|storage_manager, buf, list_ptr| {
ASM::mov_reg64_base32(buf, list_ptr, base_offset as i32);
ASM::mov_reg64_base32(buf, list_ptr, base_offset);
storage_manager.with_tmp_general_reg(buf, |storage_manager, buf, tmp| {
// calculate `element_width * index`
ASM::mov_reg64_imm64(buf, tmp, ret_stack_size as i64);

View file

@ -216,8 +216,8 @@ impl CallConv<X86_64GeneralReg, X86_64FloatReg, X86_64Assembler> for X86_64Syste
}
#[inline(always)]
fn setup_stack<'a>(
buf: &mut Vec<'a, u8>,
fn setup_stack(
buf: &mut Vec<'_, u8>,
saved_general_regs: &[X86_64GeneralReg],
saved_float_regs: &[X86_64FloatReg],
requested_stack_size: i32,
@ -233,8 +233,8 @@ impl CallConv<X86_64GeneralReg, X86_64FloatReg, X86_64Assembler> for X86_64Syste
}
#[inline(always)]
fn cleanup_stack<'a>(
buf: &mut Vec<'a, u8>,
fn cleanup_stack(
buf: &mut Vec<'_, u8>,
saved_general_regs: &[X86_64GeneralReg],
saved_float_regs: &[X86_64FloatReg],
aligned_stack_size: i32,
@ -250,11 +250,11 @@ impl CallConv<X86_64GeneralReg, X86_64FloatReg, X86_64Assembler> for X86_64Syste
}
#[inline(always)]
fn load_args<'a, 'r>(
fn load_args<'a>(
_buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<
'a,
'r,
'_,
X86_64GeneralReg,
X86_64FloatReg,
X86_64Assembler,
@ -284,11 +284,11 @@ impl CallConv<X86_64GeneralReg, X86_64FloatReg, X86_64Assembler> for X86_64Syste
}
#[inline(always)]
fn store_args<'a, 'r>(
fn store_args<'a>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<
'a,
'r,
'_,
X86_64GeneralReg,
X86_64FloatReg,
X86_64Assembler,
@ -330,11 +330,11 @@ impl CallConv<X86_64GeneralReg, X86_64FloatReg, X86_64Assembler> for X86_64Syste
storage_manager.update_fn_call_stack_size(state.tmp_stack_offset as u32);
}
fn return_complex_symbol<'a, 'r>(
fn return_complex_symbol<'a>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<
'a,
'r,
'_,
X86_64GeneralReg,
X86_64FloatReg,
X86_64Assembler,
@ -388,11 +388,11 @@ impl CallConv<X86_64GeneralReg, X86_64FloatReg, X86_64Assembler> for X86_64Syste
}
}
fn load_returned_complex_symbol<'a, 'r>(
fn load_returned_complex_symbol<'a>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<
'a,
'r,
'_,
X86_64GeneralReg,
X86_64FloatReg,
X86_64Assembler,
@ -447,10 +447,10 @@ impl X64_64SystemVStoreArgs {
const FLOAT_PARAM_REGS: &'static [X86_64FloatReg] = X86_64SystemV::FLOAT_PARAM_REGS;
const FLOAT_RETURN_REGS: &'static [X86_64FloatReg] = X86_64SystemV::FLOAT_RETURN_REGS;
fn store_arg<'a, 'r>(
fn store_arg<'a>(
&mut self,
buf: &mut Vec<'a, u8>,
storage_manager: &mut X86_64StorageManager<'a, 'r, X86_64SystemV>,
storage_manager: &mut X86_64StorageManager<'a, '_, X86_64SystemV>,
layout_interner: &mut STLayoutInterner<'a>,
sym: Symbol,
in_layout: InLayout<'a>,
@ -537,10 +537,10 @@ impl X64_64SystemVStoreArgs {
}
}
fn store_arg_general<'a, 'r>(
fn store_arg_general<'a>(
&mut self,
buf: &mut Vec<'a, u8>,
storage_manager: &mut X86_64StorageManager<'a, 'r, X86_64SystemV>,
storage_manager: &mut X86_64StorageManager<'a, '_, X86_64SystemV>,
sym: Symbol,
) {
if self.general_i < Self::GENERAL_PARAM_REGS.len() {
@ -562,10 +562,10 @@ impl X64_64SystemVStoreArgs {
}
}
fn store_arg_float<'a, 'r>(
fn store_arg_float<'a>(
&mut self,
buf: &mut Vec<'a, u8>,
storage_manager: &mut X86_64StorageManager<'a, 'r, X86_64SystemV>,
storage_manager: &mut X86_64StorageManager<'a, '_, X86_64SystemV>,
sym: Symbol,
) {
if self.float_i < Self::FLOAT_PARAM_REGS.len() {
@ -598,9 +598,9 @@ type X86_64StorageManager<'a, 'r, CallConv> =
StorageManager<'a, 'r, X86_64GeneralReg, X86_64FloatReg, X86_64Assembler, CallConv>;
impl X64_64SystemVLoadArgs {
fn load_arg<'a, 'r>(
fn load_arg<'a>(
&mut self,
storage_manager: &mut X86_64StorageManager<'a, 'r, X86_64SystemV>,
storage_manager: &mut X86_64StorageManager<'a, '_, X86_64SystemV>,
layout_interner: &mut STLayoutInterner<'a>,
sym: Symbol,
in_layout: InLayout<'a>,
@ -645,9 +645,9 @@ impl X64_64SystemVLoadArgs {
}
}
fn load_arg_general<'a, 'r>(
fn load_arg_general(
&mut self,
storage_manager: &mut X86_64StorageManager<'a, 'r, X86_64SystemV>,
storage_manager: &mut X86_64StorageManager<'_, '_, X86_64SystemV>,
sym: Symbol,
) {
if self.general_i < X86_64SystemV::GENERAL_PARAM_REGS.len() {
@ -660,9 +660,9 @@ impl X64_64SystemVLoadArgs {
}
}
fn load_arg_float<'a, 'r>(
fn load_arg_float(
&mut self,
storage_manager: &mut X86_64StorageManager<'a, 'r, X86_64SystemV>,
storage_manager: &mut X86_64StorageManager<'_, '_, X86_64SystemV>,
sym: Symbol,
) {
if self.general_i < X86_64SystemV::GENERAL_PARAM_REGS.len() {
@ -783,8 +783,8 @@ impl CallConv<X86_64GeneralReg, X86_64FloatReg, X86_64Assembler> for X86_64Windo
}
#[inline(always)]
fn setup_stack<'a>(
buf: &mut Vec<'a, u8>,
fn setup_stack(
buf: &mut Vec<'_, u8>,
saved_general_regs: &[X86_64GeneralReg],
saved_float_regs: &[X86_64FloatReg],
requested_stack_size: i32,
@ -800,8 +800,8 @@ impl CallConv<X86_64GeneralReg, X86_64FloatReg, X86_64Assembler> for X86_64Windo
}
#[inline(always)]
fn cleanup_stack<'a>(
buf: &mut Vec<'a, u8>,
fn cleanup_stack(
buf: &mut Vec<'_, u8>,
saved_general_regs: &[X86_64GeneralReg],
saved_float_regs: &[X86_64FloatReg],
aligned_stack_size: i32,
@ -817,9 +817,9 @@ impl CallConv<X86_64GeneralReg, X86_64FloatReg, X86_64Assembler> for X86_64Windo
}
#[inline(always)]
fn load_args<'a, 'r>(
fn load_args<'a>(
_buf: &mut Vec<'a, u8>,
storage_manager: &mut X86_64StorageManager<'a, 'r, X86_64WindowsFastcall>,
storage_manager: &mut X86_64StorageManager<'a, '_, X86_64WindowsFastcall>,
layout_interner: &mut STLayoutInterner<'a>,
args: &'a [(InLayout<'a>, Symbol)],
ret_layout: &InLayout<'a>,
@ -861,11 +861,11 @@ impl CallConv<X86_64GeneralReg, X86_64FloatReg, X86_64Assembler> for X86_64Windo
}
#[inline(always)]
fn store_args<'a, 'r>(
fn store_args<'a>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<
'a,
'r,
'_,
X86_64GeneralReg,
X86_64FloatReg,
X86_64Assembler,
@ -938,11 +938,11 @@ impl CallConv<X86_64GeneralReg, X86_64FloatReg, X86_64Assembler> for X86_64Windo
storage_manager.update_fn_call_stack_size(tmp_stack_offset as u32);
}
fn return_complex_symbol<'a, 'r>(
fn return_complex_symbol<'a>(
_buf: &mut Vec<'a, u8>,
_storage_manager: &mut StorageManager<
'a,
'r,
'_,
X86_64GeneralReg,
X86_64FloatReg,
X86_64Assembler,
@ -955,11 +955,11 @@ impl CallConv<X86_64GeneralReg, X86_64FloatReg, X86_64Assembler> for X86_64Windo
todo!("Returning complex symbols for X86_64");
}
fn load_returned_complex_symbol<'a, 'r>(
fn load_returned_complex_symbol<'a>(
_buf: &mut Vec<'a, u8>,
_storage_manager: &mut StorageManager<
'a,
'r,
'_,
X86_64GeneralReg,
X86_64FloatReg,
X86_64Assembler,
@ -985,8 +985,8 @@ impl X86_64WindowsFastcall {
}
#[inline(always)]
fn x86_64_generic_setup_stack<'a>(
buf: &mut Vec<'a, u8>,
fn x86_64_generic_setup_stack(
buf: &mut Vec<'_, u8>,
saved_general_regs: &[X86_64GeneralReg],
saved_float_regs: &[X86_64FloatReg],
requested_stack_size: i32,
@ -1042,8 +1042,8 @@ fn x86_64_generic_setup_stack<'a>(
#[inline(always)]
#[allow(clippy::unnecessary_wraps)]
fn x86_64_generic_cleanup_stack<'a>(
buf: &mut Vec<'a, u8>,
fn x86_64_generic_cleanup_stack(
buf: &mut Vec<'_, u8>,
saved_general_regs: &[X86_64GeneralReg],
saved_float_regs: &[X86_64FloatReg],
aligned_stack_size: i32,
@ -1183,9 +1183,9 @@ impl Assembler<X86_64GeneralReg, X86_64FloatReg> for X86_64Assembler {
imul_reg64_reg64(buf, dst, src2);
}
fn umul_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn umul_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, X86_64GeneralReg, X86_64FloatReg, ASM, CC>,
storage_manager: &mut StorageManager<'a, '_, X86_64GeneralReg, X86_64FloatReg, ASM, CC>,
dst: X86_64GeneralReg,
src1: X86_64GeneralReg,
src2: X86_64GeneralReg,
@ -1267,9 +1267,9 @@ impl Assembler<X86_64GeneralReg, X86_64FloatReg> for X86_64Assembler {
}
}
fn idiv_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn idiv_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, X86_64GeneralReg, X86_64FloatReg, ASM, CC>,
storage_manager: &mut StorageManager<'a, '_, X86_64GeneralReg, X86_64FloatReg, ASM, CC>,
dst: X86_64GeneralReg,
src1: X86_64GeneralReg,
src2: X86_64GeneralReg,
@ -1287,9 +1287,9 @@ impl Assembler<X86_64GeneralReg, X86_64FloatReg> for X86_64Assembler {
mov_reg64_reg64(buf, dst, X86_64GeneralReg::RAX);
}
fn udiv_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn udiv_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, X86_64GeneralReg, X86_64FloatReg, ASM, CC>,
storage_manager: &mut StorageManager<'a, '_, X86_64GeneralReg, X86_64FloatReg, ASM, CC>,
dst: X86_64GeneralReg,
src1: X86_64GeneralReg,
src2: X86_64GeneralReg,
@ -1734,9 +1734,9 @@ impl Assembler<X86_64GeneralReg, X86_64FloatReg> for X86_64Assembler {
binop_move_src_to_dst_reg64(buf, xor_reg64_reg64, dst, src1, src2)
}
fn shl_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn shl_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, X86_64GeneralReg, X86_64FloatReg, ASM, CC>,
storage_manager: &mut StorageManager<'a, '_, X86_64GeneralReg, X86_64FloatReg, ASM, CC>,
dst: X86_64GeneralReg,
src1: X86_64GeneralReg,
src2: X86_64GeneralReg,
@ -1747,9 +1747,9 @@ impl Assembler<X86_64GeneralReg, X86_64FloatReg> for X86_64Assembler {
shift_reg64_reg64_reg64(buf, storage_manager, shl_reg64_reg64, dst, src1, src2)
}
fn shr_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn shr_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, X86_64GeneralReg, X86_64FloatReg, ASM, CC>,
storage_manager: &mut StorageManager<'a, '_, X86_64GeneralReg, X86_64FloatReg, ASM, CC>,
dst: X86_64GeneralReg,
src1: X86_64GeneralReg,
src2: X86_64GeneralReg,
@ -1760,9 +1760,9 @@ impl Assembler<X86_64GeneralReg, X86_64FloatReg> for X86_64Assembler {
shift_reg64_reg64_reg64(buf, storage_manager, shr_reg64_reg64, dst, src1, src2)
}
fn sar_reg64_reg64_reg64<'a, 'r, ASM, CC>(
fn sar_reg64_reg64_reg64<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, 'r, X86_64GeneralReg, X86_64FloatReg, ASM, CC>,
storage_manager: &mut StorageManager<'a, '_, X86_64GeneralReg, X86_64FloatReg, ASM, CC>,
dst: X86_64GeneralReg,
src1: X86_64GeneralReg,
src2: X86_64GeneralReg,

View file

@ -885,7 +885,7 @@ impl<'a, 'r> WasmBackend<'a, 'r> {
self.code_builder.f32_eq();
}
ValueType::F64 => {
self.code_builder.f64_const(f64::from_bits(*value as u64));
self.code_builder.f64_const(f64::from_bits(*value));
self.code_builder.f64_eq();
}
}
@ -1114,7 +1114,7 @@ impl<'a, 'r> WasmBackend<'a, 'r> {
match storage {
StoredValue::VirtualMachineStack { value_type, .. } => {
match (lit, value_type) {
(Literal::Float(x), ValueType::F64) => self.code_builder.f64_const(*x as f64),
(Literal::Float(x), ValueType::F64) => self.code_builder.f64_const(*x),
(Literal::Float(x), ValueType::F32) => self.code_builder.f32_const(*x as f32),
(Literal::Int(x), ValueType::I64) => {
self.code_builder.i64_const(i128::from_ne_bytes(*x) as i64)

View file

@ -506,7 +506,7 @@ impl<'a> CodeBuilder<'a> {
stack_size
);
let new_len = stack_size - pops as usize;
let new_len = stack_size - pops;
current_stack.truncate(new_len);
if push {
current_stack.push(Symbol::WASM_TMP);

View file

@ -2347,8 +2347,8 @@ macro_rules! debug_check_ir {
}
/// Report modules that are imported, but from which nothing is used
fn report_unused_imported_modules<'a>(
state: &mut State<'a>,
fn report_unused_imported_modules(
state: &mut State<'_>,
module_id: ModuleId,
constrained_module: &ConstrainedModule,
) {

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 {

View file

@ -105,14 +105,14 @@ impl Position {
#[must_use]
pub const fn bump_column(self, count: u32) -> Self {
Self {
offset: self.offset + count as u32,
offset: self.offset + count,
}
}
#[must_use]
pub fn bump_invisible(self, count: u32) -> Self {
Self {
offset: self.offset + count as u32,
offset: self.offset + count,
}
}
@ -126,7 +126,7 @@ impl Position {
#[must_use]
pub const fn sub(self, count: u32) -> Self {
Self {
offset: self.offset - count as u32,
offset: self.offset - count,
}
}
@ -376,7 +376,7 @@ impl LineInfo {
let column = offset - self.line_offsets[line];
LineColumn {
line: line as u32,
column: column as u32,
column,
}
}

View file

@ -2537,14 +2537,14 @@ enum TypeToVar {
}
#[allow(clippy::too_many_arguments)]
fn type_to_variable<'a>(
fn type_to_variable(
subs: &mut Subs,
rank: Rank,
pools: &mut Pools,
problems: &mut Vec<TypeError>,
abilities_store: &AbilitiesStore,
obligation_cache: &mut ObligationCache,
arena: &'a bumpalo::Bump,
arena: &bumpalo::Bump,
aliases: &mut Aliases,
types: &mut Types,
typ: Index<TypeTag>,

View file

@ -183,7 +183,7 @@ fn parse_queries(src: &str, line_info: &LineInfo) -> Vec<TypeQuery> {
}
};
let mut queries_on_line = RE_TYPE_QUERY.captures_iter(line).into_iter().peekable();
let mut queries_on_line = RE_TYPE_QUERY.captures_iter(line).peekable();
if queries_on_line.peek().is_none() || line.contains(MUTLILINE_MARKER) {
consecutive_query_lines = 0;

View file

@ -1285,8 +1285,8 @@ fn write_flat_type<'a>(
}
}
pub fn push_union<'a, L: Label>(
subs: &'a Subs,
pub fn push_union<L: Label>(
subs: &Subs,
tags: &UnionLabels<L>,
fields: &mut Vec<(L, Vec<Variable>)>,
) {

View file

@ -1360,8 +1360,8 @@ fn separate_union_lambdas<M: MetaCollector>(
let mut buckets: VecMap<Symbol, Sides> = VecMap::with_capacity(fields1.len() + fields2.len());
let (mut fields_left, mut fields_right) = (
fields1.iter_all().into_iter().peekable(),
fields2.iter_all().into_iter().peekable(),
fields1.iter_all().peekable(),
fields2.iter_all().peekable(),
);
loop {