pub(super) fn deduplicate_recovered_params_names(&self, fn_inputs: &mut Vec<Param>) {
        let mut seen_inputs = FxHashSet::default();
        for input in fn_inputs.iter_mut() {
            let opt_ident = if let (PatKind::Ident(_, ident, _), TyKind::Err) =
                (&input.pat.kind, &input.ty.kind)
            {
                Some(*ident)
            } else {
                None
            };
            if let Some(ident) = opt_ident {
                if seen_inputs.contains(&ident) {
                    input.pat.kind = PatKind::Wild;
                }
                seen_inputs.insert(ident);
            }
        }
    }
/// Replace duplicated recovered parameters with `_` pattern to avoid unnecessary errors.
///
/// This is necessary because at this point we don't know whether we parsed a function with
/// anonymous parameters or a function with names but no types. In order to minimize
/// unnecessary errors, we assume the parameters are in the shape of `fn foo(a, b, c)` where
/// the parameters are *names* (so we don't emit errors about not being able to find `b` in
/// the local scope), but if we find the same name multiple times, like in `fn foo(i8, i8)`,
/// we deduplicate them to not complain about duplicated parameter names.
Replace duplicated recovered parameters with `_` pattern to avoid unnecessary errors.
This is necessary because at this point we don't know whether we parsed a function with
anonymous parameters or a function with names but no types.
Replace duplicated recovered parameters with ` _ ` pattern to avoid unnecessary errors . This is necessary because at this point we don ' t know whether we parsed a function with anonymous parameters or a function with names but no types .
pub(super) fn deduplicate_recovered_params_names(&self, fn_inputs: &mut Vec<Param>) {
        let mut seen_inputs = FxHashSet::default();
        for input in fn_inputs.iter_mut() {
            let opt_ident = if let (PatKind::Ident(_, ident, _), TyKind::Err) =
                (&input.pat.kind, &input.ty.kind)
            {
                Some(*ident)
            } else {
                None
            };
            if let Some(ident) = opt_ident {
                if seen_inputs.contains(&ident) {
                    input.pat.kind = PatKind::Wild;
                }
                seen_inputs.insert(ident);
            }
        }
    }
pub ( super ) fn deduplicate_recovered_params_names ( & self , fn_inputs : & mut Vec < Param > ) { let mut seen_inputs = FxHashSet :: default ( ) ; for input in fn_inputs . iter_mut ( ) { let opt_ident = if let ( PatKind :: Ident ( _ , ident , _ ) , TyKind :: Err ) = ( & input . pat . kind , & input . ty . kind ) { Some ( * ident ) } else { None } ; if let Some ( ident ) = opt_ident { if seen_inputs . contains ( & ident ) { input . pat . kind = PatKind :: Wild ; } seen_inputs . insert ( ident ) ; } } }
Replace duplicated recovered parameters with `_` pattern to avoid unnecessary errors.
Replace duplicated recovered parameters with ` _ ` pattern to avoid unnecessary errors .
&self
fn_inputs
&mut Vec<Param>
&self
fn_inputs
&mut Vec<Param>