Skip to content

Commit fdb59a4

Browse files
committed
Auto merge of #119002 - workingjubilee:rollup-dbfet7s, r=workingjubilee
Rollup of 5 pull requests Successful merges: - #118396 (Collect lang items from AST, get rid of `GenericBound::LangItemTrait`) - #118727 (Don't pass lint back out of lint decorator) - #118956 (Make CStr documentation consistent ("nul" instead of "null")) - #118981 (Remove an unneeded allocation) - #118998 (Link to is_benchmark from the Ipv6Addr::is_global documentation) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 4f3b8c8 + c9e00f6 commit fdb59a4

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

clippy_lints/src/len_zero.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use rustc_hir::def::Res;
88
use rustc_hir::def_id::{DefId, DefIdSet};
99
use rustc_hir::{
1010
AssocItemKind, BinOpKind, Expr, ExprKind, FnRetTy, GenericArg, GenericBound, ImplItem, ImplItemKind,
11-
ImplicitSelfKind, Item, ItemKind, LangItem, Mutability, Node, PatKind, PathSegment, PrimTy, QPath, TraitItemRef,
12-
TyKind, TypeBindingKind,
11+
ImplicitSelfKind, Item, ItemKind, Mutability, Node, PatKind, PathSegment, PrimTy, QPath, TraitItemRef,
12+
TyKind, TypeBindingKind, OpaqueTyOrigin,
1313
};
1414
use rustc_lint::{LateContext, LateLintPass};
1515
use rustc_middle::ty::{self, AssocKind, FnSig, Ty};
@@ -289,8 +289,10 @@ fn extract_future_output<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<&
289289
kind: ItemKind::OpaqueTy(opaque),
290290
..
291291
} = item
292-
&& opaque.bounds.len() == 1
293-
&& let GenericBound::LangItemTrait(LangItem::Future, _, _, generic_args) = &opaque.bounds[0]
292+
&& let OpaqueTyOrigin::AsyncFn(_) = opaque.origin
293+
&& let [GenericBound::Trait(trait_ref, _)] = &opaque.bounds
294+
&& let Some(segment) = trait_ref.trait_ref.path.segments.last()
295+
&& let Some(generic_args) = segment.args
294296
&& generic_args.bindings.len() == 1
295297
&& let TypeBindingKind::Equality {
296298
term:

clippy_utils/src/diagnostics.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ pub fn span_lint<T: LintContext>(cx: &T, lint: &'static Lint, sp: impl Into<Mult
4949
#[expect(clippy::disallowed_methods)]
5050
cx.struct_span_lint(lint, sp, msg.to_string(), |diag| {
5151
docs_link(diag, lint);
52-
diag
5352
});
5453
}
5554

@@ -90,7 +89,6 @@ pub fn span_lint_and_help<T: LintContext>(
9089
diag.help(help.to_string());
9190
}
9291
docs_link(diag, lint);
93-
diag
9492
});
9593
}
9694

@@ -134,7 +132,6 @@ pub fn span_lint_and_note<T: LintContext>(
134132
diag.note(note);
135133
}
136134
docs_link(diag, lint);
137-
diag
138135
});
139136
}
140137

@@ -152,15 +149,13 @@ where
152149
cx.struct_span_lint(lint, sp, msg.to_string(), |diag| {
153150
f(diag);
154151
docs_link(diag, lint);
155-
diag
156152
});
157153
}
158154

159155
pub fn span_lint_hir(cx: &LateContext<'_>, lint: &'static Lint, hir_id: HirId, sp: Span, msg: &str) {
160156
#[expect(clippy::disallowed_methods)]
161157
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, msg.to_string(), |diag| {
162158
docs_link(diag, lint);
163-
diag
164159
});
165160
}
166161

@@ -176,7 +171,6 @@ pub fn span_lint_hir_and_then(
176171
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, msg.to_string(), |diag| {
177172
f(diag);
178173
docs_link(diag, lint);
179-
diag
180174
});
181175
}
182176

0 commit comments

Comments
 (0)