Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Craig Disselkoen <[email protected]>
  • Loading branch information
john-h-kastner-aws and cdisselkoen authored Dec 7, 2023
1 parent 32bf33f commit b760271
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions cedar-policy-core/src/parser/cst_to_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3817,9 +3817,8 @@ mod tests {
assert!(
errs.iter()
.any(|err| { matches!(err, ParseError::ToAST(err) if err.kind() == &em) }),
"Expected to find error `{:?}`, but saw `{:?}`",
em,
errs
"Expected to find error `{em:?}`, but saw `{}`",
errs.pretty_with_helps(),
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion cedar-policy-core/src/parser/err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pub enum ParseLiteralError {

/// Errors in the CST -> AST transform, mostly well-formedness issues.
#[derive(Debug, Error, Clone, PartialEq, Eq)]
#[error("{}", .kind)]
#[error("{kind}")]
pub struct ToASTError {
kind: ToASTErrorKind,
source_info: SourceInfo,
Expand Down
2 changes: 1 addition & 1 deletion cedar-policy-core/src/parser/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,6 @@ impl<N> ASTNode<Option<N>> {
pub fn ok_or_missing(&self) -> Result<&N, ToASTError> {
self.node
.as_ref()
.ok_or_else(|| ToASTError::new(ToASTErrorKind::MissingNodeData, self.info.clone()))
.ok_or_else(|| self.to_ast_err(ToASTErrorKind::MissingNodeData))
}
}

0 comments on commit b760271

Please sign in to comment.