Skip to content

Commit

Permalink
fix(just+fmt): add fmt cmd and run it
Browse files Browse the repository at this point in the history
  • Loading branch information
yamafaktory committed Feb 3, 2025
1 parent 4e191a8 commit 53f1e05
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
14 changes: 8 additions & 6 deletions crates/jql-parser/src/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ mod tests {
#[test]
fn check_split() {
assert!(split(&[Token::GroupSeparator,]).is_empty());
assert_eq!(split(&[Token::KeySelector("abc")]), vec![vec![
&Token::KeySelector("abc")
]]);
assert_eq!(
split(&[Token::KeySelector("abc")]),
vec![vec![&Token::KeySelector("abc")]]
);
assert_eq!(
split(&[
Token::GroupSeparator,
Expand All @@ -54,9 +55,10 @@ mod tests {
Token::GroupSeparator,
Token::KeySelector("abc")
]),
vec![vec![&Token::KeySelector("abc")], vec![&Token::KeySelector(
"abc"
)],]
vec![
vec![&Token::KeySelector("abc")],
vec![&Token::KeySelector("abc")],
]
);
}
}
15 changes: 10 additions & 5 deletions crates/jql-parser/src/tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,17 @@ impl<'a> Lens<'a> {

impl fmt::Display for Lens<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}{}", self.0.stringify(), match &self.1 {
Some(lens_value) => {
lens_value.to_string()
write!(
f,
"{}{}",
self.0.stringify(),
match &self.1 {
Some(lens_value) => {
lens_value.to_string()
}
None => String::new(),
}
None => String::new(),
})
)
}
}

Expand Down
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ audit:
clippy:
cargo clippy

# Format.
fmt:
cargo fmt --all

# Fuzz parser.
fuzz:
cargo fuzz run fuzz_parser
Expand Down

0 comments on commit 53f1e05

Please sign in to comment.