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

Fix clippy lints #627

Merged
merged 1 commit into from
May 21, 2024
Merged

Fix clippy lints #627

merged 1 commit into from
May 21, 2024

Conversation

jeckersb
Copy link
Contributor

Signed-off-by: John Eckersberg jeckersb@redhat.com

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
let mut import_config = TarImportConfig::default();
import_config.allow_nonusr = options.allow_nonusr;
import_config.remap_factory_var = !options.retain_var;
let import_config = TarImportConfig {
Copy link
Member

Choose a reason for hiding this comment

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

This one is subtle; there may be a better way to handle this but the idea here is we don't want the code to stop compiling when a new field is added to TarImportConfig so I think we still at least want a ..Default::default() at the end.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doing it that way runs afoul of needless_update, but that in turn hints at the proper solution in this case - mark the struct as non_exhaustive if it could gain extra fields in the future. Just have to be careful adding that to a public struct since it's a breaking change, but in this instance TarImportConfig is pub(crate) so it's not exposed in the API.

Copy link
Member

Choose a reason for hiding this comment

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

Ah right, yeah we should be using non_exhaustive then on other structs. Something to keep in mind for the next API bump.

OTOH I was thinking about folding this repository into bootc, which would simplify things some.

@cgwalters cgwalters merged commit 6945225 into ostreedev:main May 21, 2024
10 checks passed
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.

None yet

2 participants