Skip to content

Commit

Permalink
Removed unnecessary PhantomData field
Browse files Browse the repository at this point in the history
Issue-Id: #22
  • Loading branch information
christoph-hamm committed Jul 30, 2024
1 parent bdbf138 commit 3f27f0e
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions agent/src/control_interface/authorizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,6 @@ impl From<&ControlInterfaceAccess> for Authorizer {

#[cfg(test)]
mod test {
use std::marker::PhantomData;

use common::{
commands::{CompleteStateRequest, Request, UpdateStateRequest},
objects::{AccessRightsRule, ControlInterfaceAccess, StateRule},
Expand All @@ -228,22 +226,17 @@ mod test {
#[derive(Clone, Debug, PartialEq)]
pub struct MockRule<T> {
patterns: Option<Vec<T>>,
phantom: PhantomData<T>,
}

impl<T> MockRule<T> {
pub fn create(patterns: Vec<T>) -> Self {
Self {
patterns: Some(patterns),
phantom: PhantomData,
}
}

fn default() -> Self {
Self {
patterns: None,
phantom: PhantomData,
}
Self { patterns: None }
}
}

Expand Down Expand Up @@ -378,43 +371,37 @@ mod test {
authorizer.allow_read_state_rule,
vec![MockRule {
patterns: Some(vec![AllowPathPattern::from("allow.read")]),
phantom: PhantomData
}]
);
assert_eq!(
authorizer.allow_write_state_rule,
vec![MockRule {
patterns: Some(vec![AllowPathPattern::from("allow.write")]),
phantom: PhantomData
}]
);
assert_eq!(
authorizer.allow_read_write_state_rule,
vec![MockRule {
patterns: Some(vec![AllowPathPattern::from("allow.read.write")]),
phantom: PhantomData
}]
);

assert_eq!(
authorizer.deny_read_state_rule,
vec![MockRule {
patterns: Some(vec![DenyPathPattern::from("deny.read")]),
phantom: PhantomData
}]
);
assert_eq!(
authorizer.deny_write_state_rule,
vec![MockRule {
patterns: Some(vec![DenyPathPattern::from("deny.write")]),
phantom: PhantomData
}]
);
assert_eq!(
authorizer.deny_read_write_state_rule,
vec![MockRule {
patterns: Some(vec![DenyPathPattern::from("deny.read.write")]),
phantom: PhantomData
}]
);
}
Expand Down

0 comments on commit 3f27f0e

Please sign in to comment.