Do not look for Cargo.toml inside target (#15692)

This test, which checks that we do not define new profiles directly in
Clippy's multiple `Cargo.toml` files, must not look inside `target` as
`lintcheck` might place some third-party sources there. Of course those
third-party sources are allowed to define profiles in their
`Cargo.toml`.

changelog: none
This commit is contained in:
Jason Newcomb 2025-09-17 23:31:32 +00:00 committed by GitHub
commit a67fe9c35d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,6 +17,9 @@ fn no_profile_in_cargo_toml() {
// keep it fast and simple.
for entry in WalkDir::new(".")
.into_iter()
// Do not recurse into `target` as lintcheck might put some sources (and their
// `Cargo.toml`) there.
.filter_entry(|e| e.file_name() != "target")
.filter_map(Result::ok)
.filter(|e| e.file_name().to_str() == Some("Cargo.toml"))
{