Add AlgorithmIdentifier::oids() helper function#443
Merged
tarcieri merged 1 commit intoRustCrypto:masterfrom Feb 23, 2022
Merged
Add AlgorithmIdentifier::oids() helper function#443tarcieri merged 1 commit intoRustCrypto:masterfrom
tarcieri merged 1 commit intoRustCrypto:masterfrom
Conversation
Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
tarcieri
reviewed
Feb 23, 2022
Comment on lines
+88
to
+94
| match self.parameters { | ||
| None => None, | ||
| Some(p) => match p { | ||
| Any::NULL => None, | ||
| _ => Some(p.oid()?), | ||
| }, | ||
| }, |
Member
There was a problem hiding this comment.
Suggested change
| match self.parameters { | |
| None => None, | |
| Some(p) => match p { | |
| Any::NULL => None, | |
| _ => Some(p.oid()?), | |
| }, | |
| }, | |
| self.parameters.and_then(|p| match p { | |
| Any::NULL => None, | |
| _ => Some(p.oid()?), | |
| }) |
Contributor
Author
There was a problem hiding this comment.
@tarcieri This actually doesn't compile because it embeds the error handling in the function. I think my version is actually cleaner due to this.
tarcieri
requested changes
Feb 23, 2022
Member
tarcieri
left a comment
There was a problem hiding this comment.
One nit.
I'd be curious to see a use case for this. There are a lot of helper methods like this already.
Contributor
Author
|
@tarcieri It makes it easy to do things like compare key algorithms with signature algorithms. See: https://github.com/profianinc/steward/blob/main/src/signed.rs#L169-L170 |
tarcieri
approved these changes
Feb 23, 2022
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Nathaniel McCallum nathaniel@profian.com