Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7a82702

Browse files
committed
Auto merge of rust-lang#120767 - matthiaskrgr:rollup-0k8ib1c, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - rust-lang#119592 (resolve: Unload speculatively resolved crates before freezing cstore) - rust-lang#120103 (Make it so that async-fn-in-trait is compatible with a concrete future in implementation) - rust-lang#120206 (hir: Make sure all `HirId`s have corresponding HIR `Node`s) - rust-lang#120214 (match lowering: consistently lower bindings deepest-first) - rust-lang#120688 (GVN: also turn moves into copies with projections) - rust-lang#120702 (docs: also check the inline stmt during redundant link check) - rust-lang#120727 (exhaustiveness: Prefer "`0..MAX` not covered" to "`_` not covered") - rust-lang#120734 (Add `SubdiagnosticMessageOp` as a trait alias.) - rust-lang#120739 (improve pretty printing for associated items in trait objects) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 96ff004 + b247f41 commit 7a82702

19 files changed

+32
-37
lines changed

clippy_lints/src/absolute_paths.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl LateLintPass<'_> for AbsolutePaths {
6262
} = self;
6363

6464
if !path.span.from_expansion()
65-
&& let Some(node) = cx.tcx.opt_hir_node(hir_id)
65+
&& let node = cx.tcx.hir_node(hir_id)
6666
&& !matches!(node, Node::Item(item) if matches!(item.kind, ItemKind::Use(_, _)))
6767
&& let [first, rest @ ..] = path.segments
6868
// Handle `::std`

clippy_lints/src/casts/cast_slice_different_sizes.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,8 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>, msrv: &Msrv
6868

6969
fn is_child_of_cast(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
7070
let map = cx.tcx.hir();
71-
if let Some(parent_id) = map.opt_parent_id(expr.hir_id)
72-
&& let Some(parent) = cx.tcx.opt_hir_node(parent_id)
73-
{
71+
if let Some(parent_id) = map.opt_parent_id(expr.hir_id) {
72+
let parent = cx.tcx.hir_node(parent_id);
7473
let expr = match parent {
7574
Node::Block(block) => {
7675
if let Some(parent_expr) = block.expr {

clippy_lints/src/casts/unnecessary_cast.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ pub(super) fn check<'tcx>(
144144

145145
if cast_from.kind() == cast_to.kind() && !in_external_macro(cx.sess(), expr.span) {
146146
if let Some(id) = path_to_local(cast_expr)
147-
&& let Some(span) = cx.tcx.hir().opt_span(id)
148-
&& !span.eq_ctxt(cast_expr.span)
147+
&& !cx.tcx.hir().span(id).eq_ctxt(cast_expr.span)
149148
{
150149
// Binding context is different than the identifiers context.
151150
// Weird macro wizardry could be involved here.

clippy_lints/src/derivable_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
195195
&& let Some(def_id) = trait_ref.trait_def_id()
196196
&& cx.tcx.is_diagnostic_item(sym::Default, def_id)
197197
&& let impl_item_hir = child.id.hir_id()
198-
&& let Some(Node::ImplItem(impl_item)) = cx.tcx.opt_hir_node(impl_item_hir)
198+
&& let Node::ImplItem(impl_item) = cx.tcx.hir_node(impl_item_hir)
199199
&& let ImplItemKind::Fn(_, b) = &impl_item.kind
200200
&& let Body { value: func_expr, .. } = cx.tcx.hir().body(*b)
201201
&& let &Adt(adt_def, args) = cx.tcx.type_of(item.owner_id).instantiate_identity().kind()

clippy_lints/src/empty_drop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl LateLintPass<'_> for EmptyDrop {
4242
}) = item.kind
4343
&& trait_ref.trait_def_id() == cx.tcx.lang_items().drop_trait()
4444
&& let impl_item_hir = child.id.hir_id()
45-
&& let Some(Node::ImplItem(impl_item)) = cx.tcx.opt_hir_node(impl_item_hir)
45+
&& let Node::ImplItem(impl_item) = cx.tcx.hir_node(impl_item_hir)
4646
&& let ImplItemKind::Fn(_, b) = &impl_item.kind
4747
&& let Body { value: func_expr, .. } = cx.tcx.hir().body(*b)
4848
&& let func_expr = peel_blocks(func_expr)

clippy_lints/src/escape.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
123123

124124
// TODO: Replace with Map::is_argument(..) when it's fixed
125125
fn is_argument(tcx: TyCtxt<'_>, id: HirId) -> bool {
126-
match tcx.opt_hir_node(id) {
127-
Some(Node::Pat(Pat {
126+
match tcx.hir_node(id) {
127+
Node::Pat(Pat {
128128
kind: PatKind::Binding(..),
129129
..
130-
})) => (),
130+
}) => (),
131131
_ => return false,
132132
}
133133

clippy_lints/src/explicit_write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ fn look_in_block<'tcx, 'hir>(cx: &LateContext<'tcx>, kind: &'tcx ExprKind<'hir>)
111111
// Find id of the local that expr_end_of_block resolves to
112112
&& let ExprKind::Path(QPath::Resolved(None, expr_path)) = expr_end_of_block.kind
113113
&& let Res::Local(expr_res) = expr_path.res
114-
&& let Some(Node::Pat(res_pat)) = cx.tcx.opt_hir_node(expr_res)
114+
&& let Node::Pat(res_pat) = cx.tcx.hir_node(expr_res)
115115

116116
// Find id of the local we found in the block
117117
&& let PatKind::Binding(BindingAnnotation::NONE, local_hir_id, _ident, None) = local.pat.kind

clippy_lints/src/index_refutable_slice.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,15 @@ impl<'a, 'tcx> Visitor<'tcx> for SliceIndexLintingVisitor<'a, 'tcx> {
248248

249249
// Checking for slice indexing
250250
&& let parent_id = map.parent_id(expr.hir_id)
251-
&& let Some(hir::Node::Expr(parent_expr)) = cx.tcx.opt_hir_node(parent_id)
251+
&& let hir::Node::Expr(parent_expr) = cx.tcx.hir_node(parent_id)
252252
&& let hir::ExprKind::Index(_, index_expr, _) = parent_expr.kind
253253
&& let Some(Constant::Int(index_value)) = constant(cx, cx.typeck_results(), index_expr)
254254
&& let Ok(index_value) = index_value.try_into()
255255
&& index_value < max_suggested_slice
256256

257257
// Make sure that this slice index is read only
258258
&& let maybe_addrof_id = map.parent_id(parent_id)
259-
&& let Some(hir::Node::Expr(maybe_addrof_expr)) = cx.tcx.opt_hir_node(maybe_addrof_id)
259+
&& let hir::Node::Expr(maybe_addrof_expr) = cx.tcx.hir_node(maybe_addrof_id)
260260
&& let hir::ExprKind::AddrOf(_kind, hir::Mutability::Not, _inner_expr) = maybe_addrof_expr.kind
261261
{
262262
use_info.index_use.push((index_value, map.span(parent_expr.hir_id)));

clippy_lints/src/len_zero.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ impl<'tcx> LateLintPass<'tcx> for LenZero {
147147
&& let Some(output) =
148148
parse_len_output(cx, cx.tcx.fn_sig(item.owner_id).instantiate_identity().skip_binder())
149149
{
150-
let (name, kind) = match cx.tcx.opt_hir_node(ty_hir_id) {
151-
Some(Node::ForeignItem(x)) => (x.ident.name, "extern type"),
152-
Some(Node::Item(x)) => match x.kind {
150+
let (name, kind) = match cx.tcx.hir_node(ty_hir_id) {
151+
Node::ForeignItem(x) => (x.ident.name, "extern type"),
152+
Node::Item(x) => match x.kind {
153153
ItemKind::Struct(..) => (x.ident.name, "struct"),
154154
ItemKind::Enum(..) => (x.ident.name, "enum"),
155155
ItemKind::Union(..) => (x.ident.name, "union"),

clippy_lints/src/loops/same_item_push.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub(super) fn check<'tcx>(
6363
&& let PatKind::Binding(bind_ann, ..) = pat.kind
6464
&& !matches!(bind_ann, BindingAnnotation(_, Mutability::Mut))
6565
&& let parent_node = cx.tcx.hir().parent_id(hir_id)
66-
&& let Some(Node::Local(parent_let_expr)) = cx.tcx.opt_hir_node(parent_node)
66+
&& let Node::Local(parent_let_expr) = cx.tcx.hir_node(parent_node)
6767
&& let Some(init) = parent_let_expr.init
6868
{
6969
match init.kind {

0 commit comments

Comments
 (0)