@@ -12,10 +12,7 @@ def _find_clippy_action(actions):
12
12
13
13
def _clippy_aspect_action_has_flag_impl (ctx , flags ):
14
14
env = analysistest .begin (ctx )
15
-
16
- # TODO: Replace with `analysistest.target_under_test(env)` upstream fix
17
- # https://github.com/bazelbuild/bazel-skylib/pull/299
18
- target = env .ctx .attr .target_under_test_with_aspect
15
+ target = analysistest .target_under_test (env )
19
16
20
17
clippy_action = _find_clippy_action (target .actions )
21
18
@@ -68,11 +65,7 @@ def _test_clippy_aspect_action_has_warnings_flag_test_impl(ctx):
68
65
def make_clippy_aspect_unittest (impl ):
69
66
return analysistest .make (
70
67
impl ,
71
- attrs = {
72
- # We can't just use target_under_test because we need to add our own aspect to the attribute.
73
- # See https://github.com/bazelbuild/bazel-skylib/pull/299
74
- "target_under_test_with_aspect" : attr .label (aspects = [rust_clippy_aspect ], mandatory = True ),
75
- },
68
+ extra_target_under_test_aspects = [rust_clippy_aspect ],
76
69
)
77
70
78
71
binary_clippy_aspect_action_has_warnings_flag_test = make_clippy_aspect_unittest (_binary_clippy_aspect_action_has_warnings_flag_test_impl )
@@ -89,17 +82,14 @@ def clippy_test_suite(name):
89
82
binary_clippy_aspect_action_has_warnings_flag_test (
90
83
name = "binary_clippy_aspect_action_has_warnings_flag_test" ,
91
84
target_under_test = Label ("//test/clippy:ok_binary" ),
92
- target_under_test_with_aspect = Label ("//test/clippy:ok_binary" ),
93
85
)
94
86
library_clippy_aspect_action_has_warnings_flag_test (
95
87
name = "library_clippy_aspect_action_has_warnings_flag_test" ,
96
88
target_under_test = Label ("//test/clippy:ok_library" ),
97
- target_under_test_with_aspect = Label ("//test/clippy:ok_library" ),
98
89
)
99
90
test_clippy_aspect_action_has_warnings_flag_test (
100
91
name = "test_clippy_aspect_action_has_warnings_flag_test" ,
101
92
target_under_test = Label ("//test/clippy:ok_test" ),
102
- target_under_test_with_aspect = Label ("//test/clippy:ok_test" ),
103
93
)
104
94
105
95
native .test_suite (
0 commit comments