Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

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 [email protected]

Signed-off-by: John Eckersberg <[email protected]>
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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants