Skip to content

Commit 8889587

Browse files
committed
Merge from rustc
2 parents 1e17a44 + 6db2d59 commit 8889587

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

clippy_lints/src/cognitive_complexity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl<'tcx> LateLintPass<'tcx> for CognitiveComplexity {
143143
span: Span,
144144
def_id: LocalDefId,
145145
) {
146-
if !cx.tcx.has_attr(def_id.to_def_id(), sym::test) {
146+
if !cx.tcx.has_attr(def_id, sym::test) {
147147
let expr = if is_async_fn(kind) {
148148
match get_async_fn_body(cx.tcx, body) {
149149
Some(b) => b,

clippy_lints/src/derivable_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
181181
self_ty,
182182
..
183183
}) = item.kind;
184-
if !cx.tcx.has_attr(item.owner_id.to_def_id(), sym::automatically_derived);
184+
if !cx.tcx.has_attr(item.owner_id, sym::automatically_derived);
185185
if !item.span.from_expansion();
186186
if let Some(def_id) = trait_ref.trait_def_id();
187187
if cx.tcx.is_diagnostic_item(sym::Default, def_id);

clippy_lints/src/derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl<'tcx> LateLintPass<'tcx> for Derive {
212212
}) = item.kind
213213
{
214214
let ty = cx.tcx.type_of(item.owner_id).subst_identity();
215-
let is_automatically_derived = cx.tcx.has_attr(item.owner_id.to_def_id(), sym::automatically_derived);
215+
let is_automatically_derived = cx.tcx.has_attr(item.owner_id, sym::automatically_derived);
216216

217217
check_hash_peq(cx, item.span, trait_ref, ty, is_automatically_derived);
218218
check_ord_partial_ord(cx, item.span, trait_ref, ty, is_automatically_derived);

clippy_lints/src/functions/must_use.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use super::{DOUBLE_MUST_USE, MUST_USE_CANDIDATE, MUST_USE_UNIT};
2222

2323
pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) {
2424
let attrs = cx.tcx.hir().attrs(item.hir_id());
25-
let attr = cx.tcx.get_attr(item.owner_id.to_def_id(), sym::must_use);
25+
let attr = cx.tcx.get_attr(item.owner_id, sym::must_use);
2626
if let hir::ItemKind::Fn(ref sig, _generics, ref body_id) = item.kind {
2727
let is_public = cx.effective_visibilities.is_exported(item.owner_id.def_id);
2828
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
@@ -47,7 +47,7 @@ pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Imp
4747
let is_public = cx.effective_visibilities.is_exported(item.owner_id.def_id);
4848
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
4949
let attrs = cx.tcx.hir().attrs(item.hir_id());
50-
let attr = cx.tcx.get_attr(item.owner_id.to_def_id(), sym::must_use);
50+
let attr = cx.tcx.get_attr(item.owner_id, sym::must_use);
5151
if let Some(attr) = attr {
5252
check_needless_must_use(cx, sig.decl, item.owner_id, item.span, fn_header_span, attr);
5353
} else if is_public
@@ -73,7 +73,7 @@ pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Tr
7373
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
7474

7575
let attrs = cx.tcx.hir().attrs(item.hir_id());
76-
let attr = cx.tcx.get_attr(item.owner_id.to_def_id(), sym::must_use);
76+
let attr = cx.tcx.get_attr(item.owner_id, sym::must_use);
7777
if let Some(attr) = attr {
7878
check_needless_must_use(cx, sig.decl, item.owner_id, item.span, fn_header_span, attr);
7979
} else if let hir::TraitFn::Provided(eid) = *eid {

clippy_lints/src/future_not_send.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_session::{declare_lint_pass, declare_tool_lint};
99
use rustc_span::def_id::LocalDefId;
1010
use rustc_span::{sym, Span};
1111
use rustc_trait_selection::traits::error_reporting::suggestions::TypeErrCtxtExt;
12-
use rustc_trait_selection::traits::{self, FulfillmentError};
12+
use rustc_trait_selection::traits::{self, FulfillmentError, ObligationCtxt};
1313

1414
declare_clippy_lint! {
1515
/// ### What it does
@@ -79,8 +79,10 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
7979
let send_trait = cx.tcx.get_diagnostic_item(sym::Send).unwrap();
8080
let span = decl.output.span();
8181
let infcx = cx.tcx.infer_ctxt().build();
82+
let ocx = ObligationCtxt::new(&infcx);
8283
let cause = traits::ObligationCause::misc(span, fn_def_id);
83-
let send_errors = traits::fully_solve_bound(&infcx, cause, cx.param_env, ret_ty, send_trait);
84+
ocx.register_bound(cause, cx.param_env, ret_ty, send_trait);
85+
let send_errors = ocx.select_all_or_error();
8486
if !send_errors.is_empty() {
8587
span_lint_and_then(
8688
cx,

clippy_lints/src/partialeq_ne_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'tcx> LateLintPass<'tcx> for PartialEqNeImpl {
3636
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
3737
if_chain! {
3838
if let ItemKind::Impl(Impl { of_trait: Some(ref trait_ref), items: impl_items, .. }) = item.kind;
39-
if !cx.tcx.has_attr(item.owner_id.to_def_id(), sym::automatically_derived);
39+
if !cx.tcx.has_attr(item.owner_id, sym::automatically_derived);
4040
if let Some(eq_trait) = cx.tcx.lang_items().eq_trait();
4141
if trait_ref.path.res.def_id() == eq_trait;
4242
then {

0 commit comments

Comments
 (0)