Skip to content

Commit ce661e3

Browse files
committed
do not add rayon to build.rs
1 parent 0ffe7b3 commit ce661e3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lints/par_fold/src/rayon_import.rs

+16
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ declare_lint_pass!(RayonImport => [RAYON_IMPORT]);
2929

3030
impl LateLintPass<'_> for RayonImport {
3131
fn check_crate(&mut self, cx: &LateContext<'_>) {
32+
// Skip linting if in build.rs file
33+
if cx
34+
.sess()
35+
.source_map()
36+
.span_to_filename(cx.tcx.hir().root_module().spans.inner_span)
37+
.is_real()
38+
&& cx
39+
.sess()
40+
.source_map()
41+
.span_to_filename(cx.tcx.hir().root_module().spans.inner_span)
42+
.to_string()
43+
.ends_with("build.rs")
44+
{
45+
return;
46+
}
47+
3248
let mut found_rayon_prelude = false;
3349

3450
for item_id in cx.tcx.hir().items() {

0 commit comments

Comments
 (0)