Skip to content

Commit 4d023b1

Browse files
committed
Don't check src/doc directory.
1 parent fd6a84a commit 4d023b1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/internal.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,18 @@ fn check_forbidden_code() {
66
// Do not use certain macros, functions, etc.
77
if !cargo::util::is_ci() {
88
// Only check these on CI, otherwise it could be annoying.
9+
use std::io::Write;
10+
writeln!(
11+
std::io::stderr(),
12+
"\nSkipping check_forbidden_code test, set CI=1 to enable"
13+
)
14+
.unwrap();
915
return;
1016
}
11-
let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
12-
for entry in walkdir::WalkDir::new(path)
17+
let root_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
18+
for entry in walkdir::WalkDir::new(&root_path)
1319
.into_iter()
20+
.filter_entry(|e| e.path() != root_path.join("doc"))
1421
.filter_map(|e| e.ok())
1522
{
1623
let path = entry.path();
@@ -22,6 +29,7 @@ fn check_forbidden_code() {
2229
{
2330
continue;
2431
}
32+
eprintln!("checking {}", path.display());
2533
let c = fs::read_to_string(path).unwrap();
2634
for (line_index, line) in c.lines().enumerate() {
2735
if line.trim().starts_with("//") {

0 commit comments

Comments
 (0)