Skip to content

Commit 5c572d8

Browse files
committed
fix: address Copilot review feedback (PR #456)
1 parent 6a4a67e commit 5c572d8

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

crates/pet-winpython/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ pub struct WinPython {
5252
/// Cached discovery result. Populated lazily by `find_with_cache()` and
5353
/// cleared at the start of each `find()` (refresh). Mirrors the pattern
5454
/// used by `WindowsStore` and `WindowsRegistry`.
55-
#[allow(dead_code)]
5655
cached_environments: Arc<Mutex<Option<Arc<Vec<PythonEnvironment>>>>>,
5756
}
5857

@@ -475,7 +474,10 @@ fn build_search_paths(userprofile: Option<String>, winpython_home: Option<String
475474
let mut paths: Vec<PathBuf> = Vec::new();
476475
let mut seen: std::collections::HashSet<PathBuf> = std::collections::HashSet::new();
477476
let mut push_unique = |p: PathBuf, paths: &mut Vec<PathBuf>| {
478-
if seen.insert(p.clone()) {
477+
// Normalize for dedup so case-only or separator-only differences on
478+
// Windows don't produce duplicate scans.
479+
let key = norm_case(&p);
480+
if seen.insert(key) {
479481
paths.push(p);
480482
}
481483
};
@@ -726,6 +728,7 @@ mod tests {
726728
/// `~/Desktop`, or `~/Documents` — that was the pre-#453 behavior and
727729
/// caused Defender-induced p90 latency on Windows refreshes.
728730
#[test]
731+
#[cfg(windows)]
729732
fn test_search_paths_exclude_drive_roots_and_program_files() {
730733
let paths = build_search_paths(Some(r"C:\Users\test".to_string()), None);
731734

crates/pet/src/jsonrpc.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2047,7 +2047,10 @@ mod tests {
20472047
RefreshStatePersistence::SyncedDiscoveryState,
20482048
),
20492049
#[cfg(windows)]
2050-
(LocatorKind::WinPython, RefreshStatePersistence::Stateless),
2050+
(
2051+
LocatorKind::WinPython,
2052+
RefreshStatePersistence::SyncedDiscoveryState,
2053+
),
20512054
(
20522055
LocatorKind::PyEnv,
20532056
RefreshStatePersistence::SelfHydratingCache,

0 commit comments

Comments
 (0)