]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/future_not_send.rs
Change InferCtxtBuilder from enter to build
[rust.git] / src / tools / clippy / clippy_lints / src / future_not_send.rs
index 406c842a6d053b96c39c4ff214db41088ec844bf..0519f9ac24682f7cfda45b50228e8a1f1fdca93e 100644 (file)
@@ -77,10 +77,9 @@ fn check_fn(
             if is_future {
                 let send_trait = cx.tcx.get_diagnostic_item(sym::Send).unwrap();
                 let span = decl.output.span();
-                let send_errors = cx.tcx.infer_ctxt().enter(|infcx| {
-                    let cause = traits::ObligationCause::misc(span, hir_id);
-                    traits::fully_solve_bound(&infcx, cause, cx.param_env, ret_ty, send_trait)
-                });
+                let infcx = cx.tcx.infer_ctxt().build();
+                let cause = traits::ObligationCause::misc(span, hir_id);
+                let send_errors = traits::fully_solve_bound(&infcx, cause, cx.param_env, ret_ty, send_trait);
                 if !send_errors.is_empty() {
                     span_lint_and_then(
                         cx,
@@ -88,18 +87,18 @@ fn check_fn(
                         span,
                         "future cannot be sent between threads safely",
                         |db| {
-                            cx.tcx.infer_ctxt().enter(|infcx| {
-                                for FulfillmentError { obligation, .. } in send_errors {
-                                    infcx.err_ctxt().maybe_note_obligation_cause_for_async_await(db, &obligation);
-                                    if let Trait(trait_pred) = obligation.predicate.kind().skip_binder() {
-                                        db.note(&format!(
-                                            "`{}` doesn't implement `{}`",
-                                            trait_pred.self_ty(),
-                                            trait_pred.trait_ref.print_only_trait_path(),
-                                        ));
-                                    }
+                            for FulfillmentError { obligation, .. } in send_errors {
+                                infcx
+                                    .err_ctxt()
+                                    .maybe_note_obligation_cause_for_async_await(db, &obligation);
+                                if let Trait(trait_pred) = obligation.predicate.kind().skip_binder() {
+                                    db.note(&format!(
+                                        "`{}` doesn't implement `{}`",
+                                        trait_pred.self_ty(),
+                                        trait_pred.trait_ref.print_only_trait_path(),
+                                    ));
                                 }
-                            });
+                            }
                         },
                     );
                 }