Skip to content

Commit

Permalink
util toml targets: infer file only if not a dir
Browse files Browse the repository at this point in the history
can either be regular file or a symbolic link

previously any entry ending with .rs, including directories, were
assumed to be files.
  • Loading branch information
hellux committed Feb 3, 2023
1 parent 12a26b3 commit 1cb6a1e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cargo/util/toml/targets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,10 +624,10 @@ fn infer_from_directory(directory: &Path) -> Vec<(String, PathBuf)> {
}

fn infer_any(entry: &DirEntry) -> Option<(String, PathBuf)> {
if entry.path().extension().and_then(|p| p.to_str()) == Some("rs") {
infer_file(entry)
} else if entry.file_type().map(|t| t.is_dir()).ok() == Some(true) {
if entry.file_type().map_or(false, |t| t.is_dir()) {
infer_subdirectory(entry)
} else if entry.path().extension().and_then(|p| p.to_str()) == Some("rs") {
infer_file(entry)
} else {
None
}
Expand Down

0 comments on commit 1cb6a1e

Please sign in to comment.