File tree Expand file tree Collapse file tree 6 files changed +30
-4
lines changed Expand file tree Collapse file tree 6 files changed +30
-4
lines changed Original file line number Diff line number Diff line change 1- use clippy_utils:: diagnostics:: span_lint_and_then ;
1+ use clippy_utils:: diagnostics:: span_lint_hir_and_then ;
22use clippy_utils:: source:: snippet;
33use clippy_utils:: ty:: implements_trait;
44use rustc_errors:: Applicability ;
@@ -63,9 +63,10 @@ impl<'tcx> LateLintPass<'tcx> for AsyncYieldsAsync {
6363 _ => None ,
6464 } ;
6565 if let Some ( return_expr_span) = return_expr_span {
66- span_lint_and_then (
66+ span_lint_hir_and_then (
6767 cx,
6868 ASYNC_YIELDS_ASYNC ,
69+ body. value . hir_id ,
6970 return_expr_span,
7071 "an async construct yields a type which is itself awaitable" ,
7172 |db| {
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ struct ExistingName {
4747}
4848
4949impl < ' tcx > LateLintPass < ' tcx > for SameNameMethod {
50+ #[ expect( clippy:: too_many_lines) ]
5051 fn check_crate_post ( & mut self , cx : & LateContext < ' tcx > ) {
5152 let mut map = FxHashMap :: < Res , ExistingName > :: default ( ) ;
5253
Original file line number Diff line number Diff line change 11// run-rustfix
2-
2+ #![feature(lint_reasons)]
33#![feature(async_closure)]
44#![warn(clippy::async_yields_async)]
55
@@ -65,3 +65,14 @@ fn main() {
6565 let _n = async || custom_future_type_ctor();
6666 let _o = async || f();
6767}
68+
69+ #[rustfmt::skip]
70+ #[allow(dead_code)]
71+ fn check_expect_suppression() {
72+ #[expect(clippy::async_yields_async)]
73+ let _j = async || {
74+ async {
75+ 3
76+ }
77+ };
78+ }
Original file line number Diff line number Diff line change 11// run-rustfix
2-
2+ #! [ feature ( lint_reasons ) ]
33#![ feature( async_closure) ]
44#![ warn( clippy:: async_yields_async) ]
55
@@ -65,3 +65,14 @@ fn main() {
6565 let _n = async || custom_future_type_ctor ( ) ;
6666 let _o = async || f ( ) ;
6767}
68+
69+ #[ rustfmt:: skip]
70+ #[ allow( dead_code) ]
71+ fn check_expect_suppression ( ) {
72+ #[ expect( clippy:: async_yields_async) ]
73+ let _j = async || {
74+ async {
75+ 3
76+ }
77+ } ;
78+ }
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ impl<'a> Trait for &'a str {}
9999
100100fn h(_: &dyn Trait) {}
101101
102+ #[allow(dead_code)]
102103fn check_expect_suppression() {
103104 let a = 5;
104105 #[expect(clippy::needless_borrow)]
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ impl<'a> Trait for &'a str {}
9999
100100fn h ( _: & dyn Trait ) { }
101101
102+ #[ allow( dead_code) ]
102103fn check_expect_suppression ( ) {
103104 let a = 5 ;
104105 #[ expect( clippy:: needless_borrow) ]
You can’t perform that action at this time.
0 commit comments