Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding write_to_file() in PackageManifest's impl #6074

Open
kayagokalp opened this issue May 29, 2024 · 0 comments
Open

Consider adding write_to_file() in PackageManifest's impl #6074

kayagokalp opened this issue May 29, 2024 · 0 comments

Comments

@kayagokalp
Copy link
Member

          It might be cleaner to add this logic in a a `write_to_file()` in `PackageManifest`'s impl, as  there is already a `from_file()` there.

Then this function could be simpler:

    pub(crate) fn update_proxy_address_in_manifest(
        address: &str,
        manifest: &PackageManifestFile,
    ) -> Result<()> {
           match manifest.proxy() {
               Ok(_) => {
                   let mut new_manifest = manifest.clone();
                   new_manifest.proxy.unwrap().address = address;
                   new_manifest.write_to_file();
                   Ok(())
               }
               Err(_) => // return error?
           }
}

Originally posted by @sdankel in #6069 (comment)

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

No branches or pull requests

1 participant