diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-04 21:08:22 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-04 21:08:22 +0900 |
| commit | a9f19862350c6fd3592d93515d869ffe07ecb399 (patch) | |
| tree | 3d2e97403d658476e9e42a1d179cd29b606240e2 | |
| parent | c935842b0c0c2d2c62b3a718ebe0017b7b192318 (diff) | |
| download | php-shirabe-a9f19862350c6fd3592d93515d869ffe07ecb399.tar.gz php-shirabe-a9f19862350c6fd3592d93515d869ffe07ecb399.tar.zst php-shirabe-a9f19862350c6fd3592d93515d869ffe07ecb399.zip | |
feat: resolve trivial todo!() sites with existing constructors
Replace todo!("VersionParser::new()") with VersionParser::new() at 6
call sites (array_loader, base_command, create_project_command,
vcs_repository, http_downloader x2) and EventDispatcher::io_clone with
self.io.clone(). All targets already exist on their types.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
6 files changed, 7 insertions, 16 deletions
diff --git a/crates/shirabe/src/command/base_command.rs b/crates/shirabe/src/command/base_command.rs index 6b673ed..f806854 100644 --- a/crates/shirabe/src/command/base_command.rs +++ b/crates/shirabe/src/command/base_command.rs @@ -643,8 +643,7 @@ impl<C: HasBaseCommandData> BaseCommand for C { &self, requirements: Vec<String>, ) -> Result<Vec<IndexMap<String, String>>> { - // TODO(phase-b): VersionParser has no public `new` yet - let parser: VersionParser = todo!("VersionParser::new()"); + let parser: VersionParser = VersionParser::new(); parser.parse_name_version_pairs(requirements) } diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs index 90a4d99..efbfd44 100644 --- a/crates/shirabe/src/command/create_project_command.rs +++ b/crates/shirabe/src/command/create_project_command.rs @@ -567,8 +567,7 @@ impl CreateProjectCommand { no_progress: bool, secure_http: bool, ) -> Result<bool> { - // TODO(phase-b): VersionParser has no public `new` yet - let parser: VersionParser = todo!("VersionParser::new()"); + let parser: VersionParser = VersionParser::new(); let requirements = parser.parse_name_version_pairs(vec![package_name.to_string()])?; let name = strtolower( requirements[0] diff --git a/crates/shirabe/src/event_dispatcher/event_dispatcher.rs b/crates/shirabe/src/event_dispatcher/event_dispatcher.rs index 175b689..77d016b 100644 --- a/crates/shirabe/src/event_dispatcher/event_dispatcher.rs +++ b/crates/shirabe/src/event_dispatcher/event_dispatcher.rs @@ -1307,8 +1307,7 @@ impl EventDispatcher { // ---- helpers ---- fn io_clone(&self) -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>> { - // TODO(phase-b): IOInterface is not Clone — placeholder until io ownership is resolved. - todo!("clone std::rc::Rc<std::cell::RefCell<dyn IOInterface>>") + self.io.clone() } fn composer(&self) -> PartialComposerHandle { diff --git a/crates/shirabe/src/package/loader/array_loader.rs b/crates/shirabe/src/package/loader/array_loader.rs index 634bef8..744b40a 100644 --- a/crates/shirabe/src/package/loader/array_loader.rs +++ b/crates/shirabe/src/package/loader/array_loader.rs @@ -36,10 +36,7 @@ impl ArrayLoader { pub fn new(parser: Option<VersionParser>, load_options: bool) -> Self { let parser = match parser { Some(p) => p, - None => { - // TODO(phase-b): VersionParser has no public `new` yet - todo!("VersionParser::new()") - } + None => VersionParser::new(), }; Self { version_parser: parser, diff --git a/crates/shirabe/src/repository/vcs_repository.rs b/crates/shirabe/src/repository/vcs_repository.rs index 804ba51..7a570c6 100644 --- a/crates/shirabe/src/repository/vcs_repository.rs +++ b/crates/shirabe/src/repository/vcs_repository.rs @@ -296,8 +296,7 @@ impl VcsRepository { } .into()); } - // TODO(phase-b): VersionParser has no public `new` - self.version_parser = Some(todo!("VersionParser::new()")); + self.version_parser = Some(VersionParser::new()); if self.loader.is_none() { self.loader = Some(Box::new(ArrayLoader::new( Some(todo!("phase-b: clone VersionParser")), diff --git a/crates/shirabe/src/util/http_downloader.rs b/crates/shirabe/src/util/http_downloader.rs index 89bf0a4..b33ed58 100644 --- a/crates/shirabe/src/util/http_downloader.rs +++ b/crates/shirabe/src/util/http_downloader.rs @@ -712,8 +712,7 @@ impl HttpDownloader { let versions_key = format!("{}-versions", r#type); if let Some(versions_value) = data.get(&versions_key) { if !shirabe_php_shim::empty(versions_value) { - // TODO(phase-b): VersionParser::new - let version_parser: VersionParser = todo!("VersionParser::new()"); + let version_parser: VersionParser = VersionParser::new(); let constraint = version_parser .parse_constraints(versions_value.as_string().unwrap_or(""))?; let composer_constraint = SimpleConstraint::new( @@ -745,8 +744,7 @@ impl HttpDownloader { continue; } - // TODO(phase-b): VersionParser::new - let version_parser: VersionParser = todo!("VersionParser::new()"); + let version_parser: VersionParser = VersionParser::new(); if let Some(PhpMixed::List(list)) = entry { for spec in list { let r#type = substr(key, 0, Some(-1)); |
