Skip to content

Conversation

@vshakitskiy
Copy link
Contributor

Fixes #4836.
Continuation of #4887.

The only question is that I don't know how to test ensure_packages_exist_locally. Should I extract it to a standalone function outside of the impl block?

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

Mm yes it's tricky, this bit of the codebase isn't very testable. What you've suggested sounds good to me.

RemovedPackagesNotExist { packages: Vec<String> },

#[error("Packages to update not exist: {}", packages.iter().join(", "))]
PackagesToUpdateNotExist { packages: Vec<String> },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the eco string type please

fn ensure_packages_exist_locally(
&self,
manifest: &Manifest,
packages: Vec<EcoString>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take this by reference please 🙏

Suggested change
packages: Vec<EcoString>,
packages: &[EcoString],

}

fn ensure_packages_exist_locally(
&self,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look like self is used, so this should be a module function rather than a method on this struct.

@vshakitskiy vshakitskiy requested a review from lpil December 1, 2025 19:22
@vshakitskiy vshakitskiy force-pushed the update-error-if-not-exists branch 3 times, most recently from 150a5ab to 017d5e2 Compare December 1, 2025 19:59
@vshakitskiy vshakitskiy force-pushed the update-error-if-not-exists branch from 5f977fa to c09dd5e Compare December 5, 2025 10:34
@vshakitskiy vshakitskiy force-pushed the update-error-if-not-exists branch from c09dd5e to 5ecddc2 Compare December 5, 2025 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return an error if asked to update a package that does not exist

2 participants