diff options
| author | Samuel Moelius <sam@moeli.us> | 2022-12-02 20:41:29 -0500 |
|---|---|---|
| committer | Philipp Krones <hello@philkrones.com> | 2022-12-08 20:09:08 +0100 |
| commit | 3c29e742d13314365fe0c1887d2e46a9d8a532fb (patch) | |
| tree | 9052a5cb64f6bbfdf33c235ab805859dabf0b6fc | |
| parent | 7632db0e87d8adccc9a83a47795c9411b1455855 (diff) | |
| download | rust-3c29e742d13314365fe0c1887d2e46a9d8a532fb.tar.gz rust-3c29e742d13314365fe0c1887d2e46a9d8a532fb.zip | |
Fix #10021
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs b/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs index 17b0507682a..9263f051972 100644 --- a/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs +++ b/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs @@ -386,14 +386,12 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty< Node::Expr(parent_expr) => { if let Some((callee_def_id, call_substs, recv, call_args)) = get_callee_substs_and_args(cx, parent_expr) { - if Some(callee_def_id) == cx.tcx.lang_items().into_future_fn() { - return false; - } - let fn_sig = cx.tcx.fn_sig(callee_def_id).skip_binder(); if let Some(arg_index) = recv.into_iter().chain(call_args).position(|arg| arg.hir_id == expr.hir_id) && let Some(param_ty) = fn_sig.inputs().get(arg_index) && let ty::Param(ParamTy { index: param_index , ..}) = param_ty.kind() + // https://github.com/rust-lang/rust-clippy/issues/9504 and https://github.com/rust-lang/rust-clippy/issues/10021 + && (*param_index as usize) < call_substs.len() { if fn_sig .inputs() |
