File tree Expand file tree Collapse file tree 4 files changed +55
-0
lines changed Expand file tree Collapse file tree 4 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -150,3 +150,25 @@ members = [
150
150
" ctest" ,
151
151
" libc-test" ,
152
152
]
153
+
154
+ #
155
+ # TODO: These should be renamed as `[workspace.lints.*]` once MSRV is abve 1.64
156
+ # This way all crates can use it with `[lints] workspace=true` section
157
+ #
158
+
159
+ [lints .rust ]
160
+ # TODO: make ident usage consistent in each file
161
+ unused_qualifications = " allow"
162
+
163
+ [lints .clippy ]
164
+ # TODO: all these are default lints and should probably be fixed
165
+ identity_op = " allow"
166
+ if_same_then_else = " allow"
167
+ missing_safety_doc = " allow"
168
+ non_minimal_cfg = " allow"
169
+ precedence = " allow"
170
+ redundant_field_names = " allow"
171
+ redundant_static_lifetimes = " allow"
172
+ unnecessary_cast = " allow"
173
+ unused_unit = " allow"
174
+ zero_ptr = " allow"
Original file line number Diff line number Diff line change 4
4
5
5
[ -n " ${CI:- } " ] && check=" --check"
6
6
7
+ # TODO: for some reason using `--workspace` validates a lot of generated code in ./target/** dir
8
+ cargo clippy -p libc@1.0.0-alpha.1 -p ctest --all-targets -- -D warnings
9
+
7
10
cargo test --manifest-path libc-test/Cargo.toml --test style -- --nocapture
8
11
9
12
command -v rustfmt
Original file line number Diff line number Diff line change @@ -44,9 +44,13 @@ test_target() {
44
44
# The basic command that is run each time
45
45
cmd=" cargo +$rust build --target $target "
46
46
47
+ # The basic clippy command
48
+ clippy_cmd=" cargo +$rust clippy --all-targets --target $target "
49
+
47
50
if [ " ${no_dist} " != " 0" ]; then
48
51
# If we can't download a `core`, we need to build it
49
52
cmd=" $cmd -Zbuild-std=core,alloc"
53
+ clippy_cmd=" $clippy_cmd -Zbuild-std=core,alloc"
50
54
51
55
# FIXME: With `build-std` feature, `compiler_builtins` emits a lof of lint warnings.
52
56
RUSTFLAGS=" ${RUSTFLAGS:- } -Aimproper_ctypes_definitions"
@@ -67,6 +71,9 @@ test_target() {
67
71
done
68
72
fi
69
73
74
+ # Run cargo clippy first
75
+ $clippy_cmd
76
+
70
77
# Test with expected combinations of features
71
78
$cmd
72
79
$cmd --features const-extern-fn
Original file line number Diff line number Diff line change @@ -104,3 +104,26 @@ harness = true
104
104
name = " style_tests"
105
105
path = " test/style_tests.rs"
106
106
harness = true
107
+
108
+ #
109
+ # TODO: These should be moved to the root Cargo.toml as `[workspace.lints.*]` once MSRV is abve 1.64
110
+ # replace it with `[lints] workspace=true`
111
+ #
112
+
113
+ [lints .rust ]
114
+ # TODO: make ident usage consistent in each file
115
+ unused_qualifications = " allow"
116
+
117
+ [lints .clippy ]
118
+ # TODO: fix these, and enable pedantic lints with needed exceptions
119
+ needless_return = " allow"
120
+ comparison_to_empty = " allow"
121
+ unused_io_amount = " allow"
122
+ write_with_newline = " allow"
123
+ needless_borrows_for_generic_args = " allow"
124
+ only_used_in_recursion = " allow"
125
+ match_like_matches_macro = " allow"
126
+ useless_format = " allow"
127
+ wildcard_in_or_patterns = " allow"
128
+ nonminimal_bool = " allow"
129
+ match_single_binding = " allow"
You can’t perform that action at this time.
0 commit comments