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

Update cargo-auditable integration to use .then_some() #1569

Closed
duckinator opened this issue Nov 19, 2024 · 0 comments · Fixed by #1588
Closed

Update cargo-auditable integration to use .then_some() #1569

duckinator opened this issue Nov 19, 2024 · 0 comments · Fixed by #1588

Comments

@duckinator
Copy link
Contributor

duckinator commented Nov 19, 2024

When working on #1568 I figured a way to keep optional settings from being included in serialized forms of GithubCiInfo and such.

The gist of it is, when something is dependent on a config setting:

  • have it be an Option<...>,
  • use #[serde(skip_serializing_if = "Option::is_none")]
  • when using the value, use something along the lines of need_thing.then_some(thing)

When adding cargo-auditable, it touched almost every insta snapshot, but by using this approach in #1568 it only touches snapshots enabling the omnibor integration.

This will wind up touching all those snapshots again, but it seems like a good practice to adopt.

install_cargo_cyclonedx: Some(cargo_cyclonedx_install_strategy.dash()),
install_omnibor: need_omnibor.then_some(omnibor_install_strategy.dash()),

install_cargo_auditable: install_cargo_auditable.to_owned(),
install_omnibor: need_omnibor.then_some(install_omnibor.to_owned()),

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 a pull request may close this issue.

1 participant