Skip to content

Commit

Permalink
review: Simplify ExpressionList.fmt()
Browse files Browse the repository at this point in the history
  • Loading branch information
viccuad authored and jvanz committed Jul 5, 2022
1 parent 20ffc89 commit b9c6eb7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions crates/burrego/src/opa/builtins/regex.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use anyhow::{anyhow, Result};
use core::fmt::Display;
use regex::{escape as regex_escape, Regex};
use std::fmt::Write as _; // import without risk of name clashing
use std::{fmt, str::FromStr};

pub fn split(args: &[serde_json::Value]) -> Result<serde_json::Value> {
Expand Down Expand Up @@ -116,11 +115,10 @@ struct ExpressionList(Vec<Expression>);

impl Display for ExpressionList {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut result = String::new();
for expression in self.0.iter() {
write!(result, "{}", expression)?;
write!(f, "{}", expression)?;
}
write!(f, "{}", result)
Ok(())
}
}

Expand Down

0 comments on commit b9c6eb7

Please sign in to comment.