@@ -132,15 +132,15 @@ pub fn init_path_config(settings: &Settings) -> Paths {
132132 } ;
133133
134134 // Step 2: Check for venv (pyvenv.cfg) and get 'home'
135- let ( venv_prefix, home_dir) = detect_venv ( & exe_dir) ;
135+ let ( venv_prefix, home_dir) = detect_venv ( exe_dir. as_ref ( ) ) ;
136136 let search_dir = home_dir. clone ( ) . or ( exe_dir) ;
137137
138138 // Step 3: Check for build directory
139- let build_prefix = detect_build_directory ( & search_dir) ;
139+ let build_prefix = detect_build_directory ( search_dir. as_ref ( ) ) ;
140140
141141 // Step 4: Calculate prefix via landmark search
142142 // When in venv, search_dir is home_dir, so this gives us the base Python's prefix
143- let calculated_prefix = calculate_prefix ( & search_dir, & build_prefix) ;
143+ let calculated_prefix = calculate_prefix ( search_dir. as_ref ( ) , build_prefix. as_ref ( ) ) ;
144144
145145 // Step 5: Set prefix and base_prefix
146146 if venv_prefix. is_some ( ) {
@@ -161,13 +161,13 @@ pub fn init_path_config(settings: &Settings) -> Paths {
161161 // In venv: exec_prefix = prefix (venv directory)
162162 paths. prefix . clone ( )
163163 } else {
164- calculate_exec_prefix ( & search_dir, & paths. prefix )
164+ calculate_exec_prefix ( search_dir. as_ref ( ) , paths. prefix . as_ref ( ) )
165165 } ;
166166 paths. base_exec_prefix = paths. base_prefix . clone ( ) ;
167167
168168 // Step 7: Calculate base_executable (if not already set by __PYVENV_LAUNCHER__)
169169 if paths. base_executable . is_empty ( ) {
170- paths. base_executable = calculate_base_executable ( executable. as_ref ( ) , & home_dir) ;
170+ paths. base_executable = calculate_base_executable ( executable. as_ref ( ) , home_dir. as_ref ( ) ) ;
171171 }
172172
173173 // Step 8: Build module_search_paths
@@ -195,7 +195,7 @@ fn default_prefix() -> String {
195195
196196/// Detect virtual environment by looking for pyvenv.cfg
197197/// Returns (venv_prefix, home_dir from pyvenv.cfg)
198- fn detect_venv ( exe_dir : & Option < PathBuf > ) -> ( Option < PathBuf > , Option < PathBuf > ) {
198+ fn detect_venv ( exe_dir : Option < & PathBuf > ) -> ( Option < PathBuf > , Option < PathBuf > ) {
199199 // Try exe_dir/../pyvenv.cfg first (standard venv layout: venv/bin/python)
200200 if let Some ( dir) = exe_dir
201201 && let Some ( venv_dir) = dir. parent ( )
@@ -222,8 +222,8 @@ fn detect_venv(exe_dir: &Option<PathBuf>) -> (Option<PathBuf>, Option<PathBuf>)
222222}
223223
224224/// Detect if running from a build directory
225- fn detect_build_directory ( exe_dir : & Option < PathBuf > ) -> Option < PathBuf > {
226- let dir = exe_dir. as_ref ( ) ?;
225+ fn detect_build_directory ( exe_dir : Option < & PathBuf > ) -> Option < PathBuf > {
226+ let dir = exe_dir?;
227227
228228 // Check for pybuilddir.txt (indicates build directory)
229229 if dir. join ( platform:: BUILDDIR_TXT ) . exists ( ) {
@@ -240,7 +240,7 @@ fn detect_build_directory(exe_dir: &Option<PathBuf>) -> Option<PathBuf> {
240240}
241241
242242/// Calculate prefix by searching for landmarks
243- fn calculate_prefix ( exe_dir : & Option < PathBuf > , build_prefix : & Option < PathBuf > ) -> String {
243+ fn calculate_prefix ( exe_dir : Option < & PathBuf > , build_prefix : Option < & PathBuf > ) -> String {
244244 // 1. If build directory detected, use it
245245 if let Some ( bp) = build_prefix {
246246 return bp. to_string_lossy ( ) . into_owned ( ) ;
@@ -266,7 +266,7 @@ fn calculate_prefix(exe_dir: &Option<PathBuf>, build_prefix: &Option<PathBuf>) -
266266}
267267
268268/// Calculate exec_prefix
269- fn calculate_exec_prefix ( exe_dir : & Option < PathBuf > , prefix : & str ) -> String {
269+ fn calculate_exec_prefix ( exe_dir : Option < & PathBuf > , prefix : & str ) -> String {
270270 #[ cfg( windows) ]
271271 {
272272 // Windows: exec_prefix == prefix
@@ -289,7 +289,7 @@ fn calculate_exec_prefix(exe_dir: &Option<PathBuf>, prefix: &str) -> String {
289289}
290290
291291/// Calculate base_executable
292- fn calculate_base_executable ( executable : Option < & PathBuf > , home_dir : & Option < PathBuf > ) -> String {
292+ fn calculate_base_executable ( executable : Option < & PathBuf > , home_dir : Option < & PathBuf > ) -> String {
293293 // If in venv and we have home, construct base_executable from home
294294 if let ( Some ( exe) , Some ( home) ) = ( executable, home_dir)
295295 && let Some ( exe_name) = exe. file_name ( )
0 commit comments