about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJason Newcomb <jsnewcomb@pm.me>2025-09-17 23:31:32 +0000
committerGitHub <noreply@github.com>2025-09-17 23:31:32 +0000
commita67fe9c35de2a4cf2864e3b9c49e360af0f5e577 (patch)
tree28e739b14a5ebcf28d7dcf7bd42a6c0b93a458c0
parent7a5f0bdd5d5e0ee8e8d6590052cd5328852298b9 (diff)
parente84b5ca1dd40d09b261b0a495c6cbd6a5d8cb194 (diff)
downloadrust-a67fe9c35de2a4cf2864e3b9c49e360af0f5e577.tar.gz
rust-a67fe9c35de2a4cf2864e3b9c49e360af0f5e577.zip
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
-rw-r--r--tests/no-profile-in-cargo-toml.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/no-profile-in-cargo-toml.rs b/tests/no-profile-in-cargo-toml.rs
index 2ad9bfb75de..1f8c4fae9b3 100644
--- a/tests/no-profile-in-cargo-toml.rs
+++ b/tests/no-profile-in-cargo-toml.rs
@@ -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"))
     {