Skip to content

Commit

Permalink
Combine ExtensionValidator impl blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
cobward committed Dec 18, 2024
1 parent b316f32 commit 5bd86c9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/definitions/x509/validation/extensions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,6 @@ pub fn validate_mdoc_reader_certificate_extensions(certificate: &Certificate) ->
#[derive(Default)]
struct ExtensionValidators(Vec<Box<dyn ExtensionValidator>>);

impl ExtensionValidators {
fn with<V: ExtensionValidator + 'static>(mut self, validator: V) -> Self {
self.0.push(Box::new(validator));
self
}
}

struct RequiredExtension {
found: bool,
validator: Box<dyn ExtensionValidator>,
Expand Down Expand Up @@ -175,6 +168,11 @@ trait ExtensionValidator {
}

impl ExtensionValidators {
fn with<V: ExtensionValidator + 'static>(mut self, validator: V) -> Self {
self.0.push(Box::new(validator));
self
}

fn validate_extensions<'a, Extensions>(self, extensions: Extensions) -> Vec<Error>
where
Extensions: IntoIterator<Item = &'a Extension>,
Expand Down

0 comments on commit 5bd86c9

Please sign in to comment.