-
Notifications
You must be signed in to change notification settings - Fork 26
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
Use proper flag semantics instead of passing around raw integers #69
Conversation
Yes, supposedly |
42e204f
to
3db85ac
Compare
src/rpm/package.rs
Outdated
@@ -819,7 +821,7 @@ impl RPMPackageMetadata { | |||
mode: mode.into(), | |||
modified_at: utc.timestamp_opt(mtime as i64, 0u32).unwrap(), // shouldn't fail as we are using 0 nanoseconds | |||
digest, | |||
category: FileCategory::from_u32(flags).unwrap_or_default(), | |||
flags: FileFlags::from_bits(flags).expect("Unexpected rpm file flags found"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be an error, since there it's within a try_fold
anyways, panic
seems unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it, but we should avoid any panic-ing behavior in parsing packages, regardless if incoherent or not.
FWIW, while it's still drafted I don't necessarily expect a review, still making some changes |
f3945ec
to
3f0c3fd
Compare
let algorithm = self.get_file_digest_algorithm().unwrap_or_default(); | ||
let algorithm = self | ||
.get_file_digest_algorithm() | ||
.unwrap_or(DigestAlgorithm::Md5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change: deleted Default
impl for DigestAlgorithm as it should probably be contextual
Change: renamed a few fields named after sense
to flags
closes #52