diff --git a/Cargo.toml b/Cargo.toml index 3abf96ffaa..989662db14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -179,7 +179,6 @@ needless_doctest_main = "allow" new_without_default = "allow" non_canonical_clone_impl = "allow" non_canonical_partial_ord_impl = "allow" -only_used_in_recursion = "allow" op_ref = "allow" option_map_unit_fn = "allow" partialeq_to_none = "allow" diff --git a/crates/ide-ssr/src/matching.rs b/crates/ide-ssr/src/matching.rs index 113457ba97..060897a685 100644 --- a/crates/ide-ssr/src/matching.rs +++ b/crates/ide-ssr/src/matching.rs @@ -310,6 +310,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> { Ok(()) } + #[allow(clippy::only_used_in_recursion)] fn check_constraint( &self, constraint: &Constraint, diff --git a/crates/mbe/src/expander/transcriber.rs b/crates/mbe/src/expander/transcriber.rs index b3fb0e8de1..5b7a25408a 100644 --- a/crates/mbe/src/expander/transcriber.rs +++ b/crates/mbe/src/expander/transcriber.rs @@ -282,9 +282,9 @@ fn expand_subtree( } let res = if ctx.new_meta_vars { - count(ctx, binding, 0, depth.unwrap_or(0)) + count(binding, 0, depth.unwrap_or(0)) } else { - count_old(ctx, binding, 0, *depth) + count_old(binding, 0, *depth) }; let c = match res { @@ -537,7 +537,6 @@ fn fix_up_and_push_path_tt( /// Handles `${count(t, depth)}`. `our_depth` is the recursion depth and `count_depth` is the depth /// defined by the metavar expression. fn count( - ctx: &ExpandCtx<'_, S>, binding: &Binding, depth_curr: usize, depth_max: usize, @@ -547,7 +546,7 @@ fn count( if depth_curr == depth_max { Ok(bs.len()) } else { - bs.iter().map(|b| count(ctx, b, depth_curr + 1, depth_max)).sum() + bs.iter().map(|b| count(b, depth_curr + 1, depth_max)).sum() } } Binding::Empty => Ok(0), @@ -556,16 +555,15 @@ fn count( } fn count_old( - ctx: &ExpandCtx<'_, S>, binding: &Binding, our_depth: usize, count_depth: Option, ) -> Result { match binding { Binding::Nested(bs) => match count_depth { - None => bs.iter().map(|b| count_old(ctx, b, our_depth + 1, None)).sum(), + None => bs.iter().map(|b| count_old(b, our_depth + 1, None)).sum(), Some(0) => Ok(bs.len()), - Some(d) => bs.iter().map(|b| count_old(ctx, b, our_depth + 1, Some(d - 1))).sum(), + Some(d) => bs.iter().map(|b| count_old(b, our_depth + 1, Some(d - 1))).sum(), }, Binding::Empty => Ok(0), Binding::Fragment(_) | Binding::Missing(_) => {