Skip to content

Commit

Permalink
Fix constructor call for patttern (#484)
Browse files Browse the repository at this point in the history
Signed-off-by: John Kastner <[email protected]>
  • Loading branch information
john-h-kastner-aws authored Nov 22, 2024
1 parent 4cd9ece commit 473b5d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cedar-drt/fuzz/fuzz_targets/wildcard-matching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ fn wildcard_match_regex<'a>(
fuzz_target!(|input: FuzzTargetInput| {
// Ensure wildcard matching is equivalent to the regex version
let regex_result = wildcard_match_regex(&input.string, &input.pattern);
let rust_result = Pattern::new(input.pattern).wildcard_match(&input.string);
let rust_result = Pattern::from(input.pattern).wildcard_match(&input.string);
assert_eq!(
regex_result, rust_result,
"\nregex result: {};rust result:{}.\n",
Expand Down
7 changes: 2 additions & 5 deletions cedar-policy-generators/src/abac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,7 @@ impl ConstantPool {

/// Produce a RHS of a like operation
/// It's derived from a random string constant in the pool: We perform transformations over it such as adding a char, deleting a char and adding a wildcard star.
pub fn arbitrary_pattern_literal(
&self,
u: &mut Unstructured<'_>,
) -> Result<Vec<ast::PatternElem>> {
pub fn arbitrary_pattern_literal(&self, u: &mut Unstructured<'_>) -> Result<ast::Pattern> {
let matched_string = self.arbitrary_string_constant_bounded(u, MAX_PATTERN_LEN)?;

let mut pattern = Vec::new();
Expand Down Expand Up @@ -246,7 +243,7 @@ impl ConstantPool {
{}
)
}
Ok(pattern)
Ok(ast::Pattern::from(pattern))
}

// Generate a valid IPv4 net representation
Expand Down

0 comments on commit 473b5d0

Please sign in to comment.