File tree 1 file changed +22
-2
lines changed
1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,33 @@ load(
23
23
)
24
24
load ("//rust/private:utils.bzl" , "determine_output_hash" , "find_cc_toolchain" , "find_toolchain" )
25
25
26
- def _clippy_aspect_impl (target , ctx ):
26
+ def _get_clippy_ready_crate_info (target ):
27
+ """Check that a target is suitable for clippy and extract the `CrateInfo` provider from it.
28
+
29
+ Args:
30
+ target (Target): The target the aspect is running on.
31
+
32
+ Returns:
33
+ CrateInfo, optional: A `CrateInfo` provider if clippy should be run or `None`.
34
+ """
35
+
36
+ # Ignore external targets
37
+ if target .label .workspace_root .startswith ("external" ):
38
+ return None
39
+
40
+ # Obviously ignore any targets that don't contain `CrateInfo`
27
41
if rust_common .crate_info not in target :
42
+ return None
43
+
44
+ return target [rust_common .crate_info ]
45
+
46
+ def _clippy_aspect_impl (target , ctx ):
47
+ crate_info = _get_clippy_ready_crate_info (target )
48
+ if not crate_info :
28
49
return []
29
50
30
51
toolchain = find_toolchain (ctx )
31
52
cc_toolchain , feature_configuration = find_cc_toolchain (ctx )
32
- crate_info = target [rust_common .crate_info ]
33
53
crate_type = crate_info .type
34
54
35
55
dep_info , build_info = collect_deps (
You can’t perform that action at this time.
0 commit comments