xref: /aosp_15_r20/external/bazelbuild-rules_rust/test/clippy/BUILD.bazel (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1load(
2    "@rules_rust//rust:defs.bzl",
3    "rust_binary",
4    "rust_clippy",
5    "rust_library",
6    "rust_proc_macro",
7    "rust_shared_library",
8    "rust_static_library",
9    "rust_test",
10)
11
12package(default_visibility = ["//test:__subpackages__"])
13
14# Declaration of passing targets.
15
16rust_binary(
17    name = "ok_binary",
18    srcs = ["src/main.rs"],
19    edition = "2018",
20)
21
22rust_library(
23    name = "ok_library",
24    srcs = ["src/lib.rs"],
25    edition = "2018",
26)
27
28rust_shared_library(
29    name = "ok_shared_library",
30    srcs = ["src/lib.rs"],
31    edition = "2018",
32)
33
34rust_static_library(
35    name = "ok_static_library",
36    srcs = ["src/lib.rs"],
37    edition = "2018",
38)
39
40rust_test(
41    name = "ok_test",
42    srcs = ["src/lib.rs"],
43    edition = "2018",
44)
45
46rust_proc_macro(
47    name = "ok_proc_macro",
48    srcs = ["src/proc_macro.rs"],
49    edition = "2018",
50)
51
52# Clippy analysis of passing targets.
53
54rust_clippy(
55    name = "ok_binary_clippy",
56    deps = [":ok_binary"],
57)
58
59rust_clippy(
60    name = "ok_library_clippy",
61    deps = [":ok_library"],
62)
63
64rust_clippy(
65    name = "ok_shared_library_clippy",
66    deps = [":ok_shared_library"],
67)
68
69rust_clippy(
70    name = "ok_static_library_clippy",
71    deps = [":ok_static_library"],
72)
73
74rust_clippy(
75    name = "ok_test_clippy",
76    testonly = True,
77    deps = [":ok_test"],
78)
79
80rust_clippy(
81    name = "ok_proc_macro_clippy",
82    deps = [":ok_proc_macro"],
83)
84
85# Declaration of failing targets.
86
87rust_binary(
88    name = "bad_binary",
89    srcs = ["bad_src/main.rs"],
90    edition = "2018",
91    tags = ["noclippy"],
92)
93
94rust_library(
95    name = "bad_library",
96    srcs = ["bad_src/lib.rs"],
97    edition = "2018",
98    tags = ["noclippy"],
99)
100
101rust_library(
102    name = "bad_shared_library",
103    srcs = ["bad_src/lib.rs"],
104    edition = "2018",
105    tags = ["noclippy"],
106)
107
108rust_library(
109    name = "bad_static_library",
110    srcs = ["bad_src/lib.rs"],
111    edition = "2018",
112    tags = ["noclippy"],
113)
114
115rust_test(
116    name = "bad_test",
117    srcs = ["bad_src/lib.rs"],
118    edition = "2018",
119    tags = ["noclippy"],
120)
121
122rust_proc_macro(
123    name = "bad_proc_macro",
124    srcs = ["bad_src/proc_macro.rs"],
125    edition = "2018",
126    tags = ["noclippy"],
127)
128
129# Clippy analysis of failing targets.
130
131rust_clippy(
132    name = "bad_binary_clippy",
133    tags = ["manual"],
134    deps = [":bad_binary"],
135)
136
137rust_clippy(
138    name = "bad_library_clippy",
139    tags = ["manual"],
140    deps = [":bad_library"],
141)
142
143rust_clippy(
144    name = "bad_shared_library_clippy",
145    tags = ["manual"],
146    deps = [":bad_shared_library"],
147)
148
149rust_clippy(
150    name = "bad_static_library_clippy",
151    tags = ["manual"],
152    deps = [":bad_static_library"],
153)
154
155rust_clippy(
156    name = "bad_test_clippy",
157    testonly = True,
158    tags = ["manual"],
159    deps = [":bad_test"],
160)
161
162rust_clippy(
163    name = "bad_proc_macro_clippy",
164    tags = ["manual"],
165    deps = [":bad_proc_macro"],
166)
167
168sh_binary(
169    name = "clippy_failure_test",
170    srcs = ["clippy_failure_test.sh"],
171)
172