File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,33 @@ load(
2323)
2424load ("//rust/private:utils.bzl" , "determine_output_hash" , "find_cc_toolchain" , "find_toolchain" )
2525
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`
2741 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 :
2849 return []
2950
3051 toolchain = find_toolchain (ctx )
3152 cc_toolchain , feature_configuration = find_cc_toolchain (ctx )
32- crate_info = target [rust_common .crate_info ]
3353 crate_type = crate_info .type
3454
3555 dep_info , build_info = collect_deps (
You can’t perform that action at this time.
0 commit comments