Skip to content

Commit c422631

Browse files
authored
Merge pull request #19169 from lnicola/sync-from-rust
minor: Sync from downstream
2 parents 9ad9ce8 + de981ab commit c422631

File tree

216 files changed

+2497
-1721
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+2497
-1721
lines changed

clippy_lints/src/arbitrary_source_item_ordering.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ impl<'tcx> LateLintPass<'tcx> for ArbitrarySourceItemOrdering {
338338
return;
339339
}
340340

341-
let items = module.item_ids.iter().map(|&id| cx.tcx.hir().item(id));
341+
let items = module.item_ids.iter().map(|&id| cx.tcx.hir_item(id));
342342

343343
// Iterates over the items within a module.
344344
//

clippy_lints/src/async_yields_async.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ impl<'tcx> LateLintPass<'tcx> for AsyncYieldsAsync {
6060
// XXXkhuey maybe we should?
6161
return;
6262
},
63-
CoroutineSource::Block => cx.tcx.hir().body(*body_id).value,
63+
CoroutineSource::Block => cx.tcx.hir_body(*body_id).value,
6464
CoroutineSource::Closure => {
6565
// Like `async fn`, async closures are wrapped in an additional block
6666
// to move all of the closure's arguments into the future.
6767

68-
let async_closure_body = cx.tcx.hir().body(*body_id).value;
68+
let async_closure_body = cx.tcx.hir_body(*body_id).value;
6969
let ExprKind::Block(block, _) = async_closure_body.kind else {
7070
return;
7171
};

clippy_lints/src/attrs/utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ pub(super) fn is_lint_level(symbol: Symbol, attr_id: AttrId) -> bool {
2222

2323
pub(super) fn is_relevant_item(cx: &LateContext<'_>, item: &Item<'_>) -> bool {
2424
if let ItemKind::Fn { body: eid, .. } = item.kind {
25-
is_relevant_expr(cx, cx.tcx.typeck_body(eid), cx.tcx.hir().body(eid).value)
25+
is_relevant_expr(cx, cx.tcx.typeck_body(eid), cx.tcx.hir_body(eid).value)
2626
} else {
2727
true
2828
}
2929
}
3030

3131
pub(super) fn is_relevant_impl(cx: &LateContext<'_>, item: &ImplItem<'_>) -> bool {
3232
match item.kind {
33-
ImplItemKind::Fn(_, eid) => is_relevant_expr(cx, cx.tcx.typeck_body(eid), cx.tcx.hir().body(eid).value),
33+
ImplItemKind::Fn(_, eid) => is_relevant_expr(cx, cx.tcx.typeck_body(eid), cx.tcx.hir_body(eid).value),
3434
_ => false,
3535
}
3636
}
@@ -39,7 +39,7 @@ pub(super) fn is_relevant_trait(cx: &LateContext<'_>, item: &TraitItem<'_>) -> b
3939
match item.kind {
4040
TraitItemKind::Fn(_, TraitFn::Required(_)) => true,
4141
TraitItemKind::Fn(_, TraitFn::Provided(eid)) => {
42-
is_relevant_expr(cx, cx.tcx.typeck_body(eid), cx.tcx.hir().body(eid).value)
42+
is_relevant_expr(cx, cx.tcx.typeck_body(eid), cx.tcx.hir_body(eid).value)
4343
},
4444
_ => false,
4545
}

clippy_lints/src/booleans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ fn simplify_not(cx: &LateContext<'_>, curr_msrv: &Msrv, expr: &Expr<'_>) -> Opti
452452
})
453453
},
454454
ExprKind::Closure(closure) => {
455-
let body = cx.tcx.hir().body(closure.body);
455+
let body = cx.tcx.hir_body(closure.body);
456456
let params = body
457457
.params
458458
.iter()

clippy_lints/src/casts/cast_ptr_alignment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn is_used_as_unaligned(cx: &LateContext<'_>, e: &Expr<'_>) -> bool {
6666
if matches!(name.ident.as_str(), "read_unaligned" | "write_unaligned")
6767
&& let Some(def_id) = cx.typeck_results().type_dependent_def_id(parent.hir_id)
6868
&& let Some(def_id) = cx.tcx.impl_of_method(def_id)
69-
&& cx.tcx.type_of(def_id).instantiate_identity().is_unsafe_ptr()
69+
&& cx.tcx.type_of(def_id).instantiate_identity().is_raw_ptr()
7070
{
7171
true
7272
} else {

clippy_lints/src/collection_is_never_read.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ fn has_no_read_access<'tcx, T: Visitable<'tcx>>(cx: &LateContext<'tcx>, id: HirI
118118
let is_read_in_closure_arg = args.iter().any(|arg| {
119119
if let ExprKind::Closure(closure) = arg.kind
120120
// To keep things simple, we only check the first param to see if its read.
121-
&& let Body { params: [param, ..], value } = cx.tcx.hir().body(closure.body)
121+
&& let Body { params: [param, ..], value } = cx.tcx.hir_body(closure.body)
122122
{
123123
!has_no_read_access(cx, param.hir_id, *value)
124124
} else {

clippy_lints/src/dereference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ fn try_parse_ref_op<'tcx>(
682682
},
683683
[arg],
684684
) => (true, typeck.qpath_res(path, *hir_id).opt_def_id()?, arg),
685-
ExprKind::Unary(UnOp::Deref, sub_expr) if !typeck.expr_ty(sub_expr).is_unsafe_ptr() => {
685+
ExprKind::Unary(UnOp::Deref, sub_expr) if !typeck.expr_ty(sub_expr).is_raw_ptr() => {
686686
return Some((RefOp::Deref, sub_expr));
687687
},
688688
ExprKind::AddrOf(BorrowKind::Ref, mutability, sub_expr) => return Some((RefOp::AddrOf(mutability), sub_expr)),

clippy_lints/src/derivable_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
197197
&& let impl_item_hir = child.id.hir_id()
198198
&& let Node::ImplItem(impl_item) = cx.tcx.hir_node(impl_item_hir)
199199
&& let ImplItemKind::Fn(_, b) = &impl_item.kind
200-
&& let Body { value: func_expr, .. } = cx.tcx.hir().body(*b)
200+
&& let Body { value: func_expr, .. } = cx.tcx.hir_body(*b)
201201
&& let &ty::Adt(adt_def, args) = cx.tcx.type_of(item.owner_id).instantiate_identity().kind()
202202
&& let attrs = cx.tcx.hir().attrs(item.hir_id())
203203
&& !attrs.iter().any(|attr| attr.doc_str().is_some())

clippy_lints/src/derive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,8 @@ impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> {
437437
walk_expr(self, expr)
438438
}
439439

440-
fn nested_visit_map(&mut self) -> Self::Map {
441-
self.cx.tcx.hir()
440+
fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
441+
self.cx.tcx
442442
}
443443
}
444444

clippy_lints/src/doc/missing_headers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub fn check(
6868
} else if let Some(body_id) = body_id
6969
&& let Some(future) = cx.tcx.lang_items().future_trait()
7070
&& let typeck = cx.tcx.typeck_body(body_id)
71-
&& let body = cx.tcx.hir().body(body_id)
71+
&& let body = cx.tcx.hir_body(body_id)
7272
&& let ret_ty = typeck.expr_ty(body.value)
7373
&& implements_trait_with_env(
7474
cx.tcx,

0 commit comments

Comments
 (0)