Skip to content

Commit 428f8f4

Browse files
committed
Refactor get_dynamic_search_path
Will need it in a follow-up PR
1 parent 29f8d03 commit 428f8f4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/cargo/core/compiler/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,13 @@ fn add_plugin_deps(
659659
Ok(())
660660
}
661661

662+
fn get_dynamic_search_path(path: &Path) -> &Path {
663+
match path.to_str().and_then(|s| s.split_once("=")) {
664+
Some(("native" | "crate" | "dependency" | "framework" | "all", path)) => Path::new(path),
665+
_ => path,
666+
}
667+
}
668+
662669
// Determine paths to add to the dynamic search path from -L entries
663670
//
664671
// Strip off prefixes like "native=" or "framework=" and filter out directories
@@ -670,10 +677,7 @@ where
670677
{
671678
let mut search_path = vec![];
672679
for dir in paths {
673-
let dir = match dir.to_str().and_then(|s| s.split_once("=")) {
674-
Some(("native" | "crate" | "dependency" | "framework" | "all", path)) => path.into(),
675-
_ => dir.clone(),
676-
};
680+
let dir = get_dynamic_search_path(dir).to_path_buf();
677681
if dir.starts_with(&root_output) {
678682
search_path.push(dir);
679683
} else {

0 commit comments

Comments
 (0)