Skip to content

Commit 2cc225d

Browse files
elrrrrrrrclaude
andcommitted
refactor(ruborist): remove From<bool> for PeerDeps impl
The implicit bool→enum conversion had counter-intuitive semantics (true=Skip, false=Include). Use explicit match at the call site instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent afd0186 commit 2cc225d

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

crates/pm/src/util/user_config.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::sync::{LazyLock, OnceLock};
44

55
use anyhow::Result;
66
use dashmap::DashMap;
7+
use utoo_ruborist::builder::PeerDeps;
78
use utoo_ruborist::manifest::PackageJson;
89
use utoo_ruborist::spec::Catalogs;
910

@@ -83,8 +84,11 @@ pub fn set_legacy_peer_deps(value: Option<bool>) {
8384
LEGACY_PEER_DEPS.set(value);
8485
}
8586

86-
pub async fn get_peer_deps() -> utoo_ruborist::builder::PeerDeps {
87-
LEGACY_PEER_DEPS.get().await.into()
87+
pub async fn get_peer_deps() -> PeerDeps {
88+
match LEGACY_PEER_DEPS.get().await {
89+
true => PeerDeps::Skip,
90+
false => PeerDeps::Include,
91+
}
8892
}
8993

9094
static OMIT: OnceLock<HashSet<OmitType>> = OnceLock::new();

crates/ruborist/src/model/node.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ pub enum PeerDeps {
2222
Skip,
2323
}
2424

25-
impl From<bool> for PeerDeps {
26-
/// `true` (legacy_peer_deps) → `Skip`, `false` → `Include`.
27-
fn from(legacy: bool) -> Self {
28-
if legacy { Self::Skip } else { Self::Include }
29-
}
30-
}
31-
3225
/// Controls whether dev dependencies are included during edge iteration.
3326
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3427
pub enum DevDeps {

0 commit comments

Comments
 (0)