Skip to content

Commit c1f7bb9

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

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/cargo/core/compiler/mod.rs

Lines changed: 9 additions & 5 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,12 +677,9 @@ 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);
677681
if dir.starts_with(&root_output) {
678-
search_path.push(dir);
682+
search_path.push(dir.to_path_buf());
679683
} else {
680684
debug!(
681685
"Not including path {} in runtime library search path because it is \

0 commit comments

Comments
 (0)