about summary refs log tree commit diff
path: root/clippy_lints/src/methods
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-03-09 19:53:59 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-03-10 19:22:55 +0000
commit5c85cd9fee1ca177187b424a4328fa298c19a9aa (patch)
tree6cb9e95e5fb7f1d5699f98355017ec49dc0470a7 /clippy_lints/src/methods
parent27910cbcbdf76afb93e769ac66efa76271f964b0 (diff)
downloadrust-5c85cd9fee1ca177187b424a4328fa298c19a9aa.tar.gz
rust-5c85cd9fee1ca177187b424a4328fa298c19a9aa.zip
Directly construct Inherited.
Diffstat (limited to 'clippy_lints/src/methods')
-rw-r--r--clippy_lints/src/methods/unnecessary_to_owned.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/clippy_lints/src/methods/unnecessary_to_owned.rs b/clippy_lints/src/methods/unnecessary_to_owned.rs
index df26b36b7b3..4c4c003ca46 100644
--- a/clippy_lints/src/methods/unnecessary_to_owned.rs
+++ b/clippy_lints/src/methods/unnecessary_to_owned.rs
@@ -369,10 +369,10 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
             Node::Item(item) => {
                 if let ItemKind::Fn(_, _, body_id) = &item.kind
                 && let output_ty = return_ty(cx, item.owner_id)
-                && Inherited::build(cx.tcx, item.owner_id.def_id).enter(|inherited| {
-                    let fn_ctxt = FnCtxt::new(inherited, cx.param_env, item.owner_id.def_id);
-                    fn_ctxt.can_coerce(ty, output_ty)
-                }) {
+                && let inherited = Inherited::new(cx.tcx, item.owner_id.def_id)
+                && let fn_ctxt = FnCtxt::new(&inherited, cx.param_env, item.owner_id.def_id)
+                && fn_ctxt.can_coerce(ty, output_ty)
+                {
                     if has_lifetime(output_ty) && has_lifetime(ty) {
                         return false;
                     }