Skip to content

Commit 29484b1

Browse files
committed
refactor: run cargo fmt --all
1 parent 468d7a0 commit 29484b1

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

src/test_utils.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,12 @@ pub fn assert_eq_vec<T: ToString>(expected: &[&str], actual: &[T]) {
302302

303303
pub fn only<T>(v: impl IntoIterator<Item = T>) -> T {
304304
let mut iter = v.into_iter();
305-
match (iter.next(), iter.next()) { (Some(item), None) => {
306-
item
307-
} _ => {
308-
panic!("only called on collection without exactly one item")
309-
}}
305+
match (iter.next(), iter.next()) {
306+
(Some(item), None) => item,
307+
_ => {
308+
panic!("only called on collection without exactly one item")
309+
}
310+
}
310311
}
311312

312313
pub fn expr_from_projection(item: &SelectItem) -> &Expr {

tests/sqlparser_common.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -1122,9 +1122,7 @@ fn parse_column_aliases() {
11221122
let sql = "SELECT a.col + 1 AS newname FROM foo AS a";
11231123
let select = verified_only_select(sql);
11241124
if let SelectItem::ExprWithAlias {
1125-
expr: Expr::BinaryOp {
1126-
op, right, ..
1127-
},
1125+
expr: Expr::BinaryOp { op, right, .. },
11281126
alias,
11291127
} = only(&select.projection)
11301128
{
@@ -3280,16 +3278,18 @@ fn test_double_value() {
32803278

32813279
for (input, expected) in test_cases {
32823280
for (i, expr) in input.iter().enumerate() {
3283-
match dialects.one_statement_parses_to(&format!("SELECT {}", expr), "")
3284-
{ Statement::Query(query) => {
3285-
if let SetExpr::Select(select) = *query.body {
3286-
assert_eq!(expected[i], select.projection[0]);
3287-
} else {
3281+
match dialects.one_statement_parses_to(&format!("SELECT {}", expr), "") {
3282+
Statement::Query(query) => {
3283+
if let SetExpr::Select(select) = *query.body {
3284+
assert_eq!(expected[i], select.projection[0]);
3285+
} else {
3286+
panic!("Expected a SELECT statement");
3287+
}
3288+
}
3289+
_ => {
32883290
panic!("Expected a SELECT statement");
32893291
}
3290-
} _ => {
3291-
panic!("Expected a SELECT statement");
3292-
}}
3292+
}
32933293
}
32943294
}
32953295
}

0 commit comments

Comments
 (0)