From 165b77b169fbb13a984b6d80f610e3aaa33334e6 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 6 Jun 2026 15:26:27 +0900 Subject: refactor(link): drop phase-b shared-ownership TODO Link is an immutable value object and is never compared by reference identity, so cloning its fields is faithful to PHP. The shared-ownership TODO does not apply. Co-Authored-By: Claude Opus 4.8 --- crates/shirabe/src/package/link.rs | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'crates/shirabe/src') diff --git a/crates/shirabe/src/package/link.rs b/crates/shirabe/src/package/link.rs index ab1e9c6..946c664 100644 --- a/crates/shirabe/src/package/link.rs +++ b/crates/shirabe/src/package/link.rs @@ -1,9 +1,9 @@ //! ref: composer/src/Composer/Package/Link.php -use shirabe_semver::constraint::AnyConstraint; - use crate::package::PackageInterfaceHandle; +use shirabe_semver::constraint::AnyConstraint; +#[derive(Clone, Debug)] pub struct Link { pub(crate) source: String, pub(crate) target: String, @@ -12,31 +12,6 @@ pub struct Link { pub(crate) pretty_constraint: String, } -impl Clone for Link { - fn clone(&self) -> Self { - // TODO(phase-b): Link is a PHP class; this clone is a shallow placeholder until - // Link is shared via Rc. - Self { - source: self.source.clone(), - target: self.target.clone(), - constraint: self.constraint.clone(), - description: self.description.clone(), - pretty_constraint: self.pretty_constraint.clone(), - } - } -} - -impl std::fmt::Debug for Link { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("Link") - .field("source", &self.source) - .field("target", &self.target) - .field("description", &self.description) - .field("pretty_constraint", &self.pretty_constraint) - .finish() - } -} - impl Link { pub const TYPE_REQUIRE: &'static str = "requires"; pub const TYPE_DEV_REQUIRE: &'static str = "devRequires"; -- cgit v1.3.1