Skip to content

Commit 6298ade

Browse files
committed
Cargo fmt
1 parent 174bda1 commit 6298ade

3 files changed

Lines changed: 34 additions & 21 deletions

File tree

src/ast/dml.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@ use serde::{Deserialize, Serialize};
2525
use sqlparser_derive::{Visit, VisitMut};
2626

2727
use crate::{
28-
ast::{display_separated},
29-
display_utils::{Indent, SpaceOrNewline, indented_list},
28+
ast::display_separated,
29+
display_utils::{indented_list, Indent, SpaceOrNewline},
3030
};
3131

3232
use super::{
33-
Assignment, Expr, FromTable, Ident, InsertAliases, MysqlInsertPriority, ObjectName, OnInsert, OptimizerHint, OrderByExpr, Query, SelectInto, SelectItem, Setting, SqliteOnConflict, TableFactor, TableObject, TableWithJoins, UpdateTableFromKind, Values, display_comma_separated, helpers::attached_token::AttachedToken, query::InputFormatClause
33+
display_comma_separated, helpers::attached_token::AttachedToken, query::InputFormatClause,
34+
Assignment, Expr, FromTable, Ident, InsertAliases, MysqlInsertPriority, ObjectName, OnInsert,
35+
OptimizerHint, OrderByExpr, Query, SelectInto, SelectItem, Setting, SqliteOnConflict,
36+
TableFactor, TableObject, TableWithJoins, UpdateTableFromKind, Values,
3437
};
3538

3639
/// INSERT statement.
@@ -117,7 +120,8 @@ impl Display for Insert {
117120
"REPLACE"
118121
} else {
119122
"INSERT"
120-
})?;
123+
}
124+
)?;
121125
if let Some(hint) = self.optimizer_hint.as_ref() {
122126
write!(f, " {hint}")?;
123127
}
@@ -375,9 +379,12 @@ impl Display for Merge {
375379
if self.into {
376380
write!(f, " INTO")?;
377381
}
378-
write!(f, " {table} USING {source} ",
382+
write!(
383+
f,
384+
" {table} USING {source} ",
379385
table = self.table,
380-
source = self.source)?;
386+
source = self.source
387+
)?;
381388
write!(f, "ON {on} ", on = self.on)?;
382389
write!(f, "{}", display_separated(&self.clauses, " "))?;
383390
if let Some(ref output) = self.output {

tests/sqlparser_mysql.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4379,21 +4379,29 @@ fn test_optimizer_hints() {
43794379
);
43804380

43814381
// ~ inserts / replace
4382-
mysql_dialect.verified_stmt("\
4382+
mysql_dialect.verified_stmt(
4383+
"\
43834384
INSERT /*+ RESOURCE_GROUP(Batch) */ \
4384-
INTO t2 VALUES (2)");
4385+
INTO t2 VALUES (2)",
4386+
);
43854387

4386-
mysql_dialect.verified_stmt("\
4388+
mysql_dialect.verified_stmt(
4389+
"\
43874390
REPLACE /*+ foobar */ INTO test \
4388-
VALUES (1, 'Old', '2014-08-20 18:47:00')");
4391+
VALUES (1, 'Old', '2014-08-20 18:47:00')",
4392+
);
43894393

43904394
// ~ updates
4391-
mysql_dialect.verified_stmt("\
4395+
mysql_dialect.verified_stmt(
4396+
"\
43924397
UPDATE /*+ quux */ table_name \
43934398
SET column1 = 1 \
4394-
WHERE 1 = 1");
4399+
WHERE 1 = 1",
4400+
);
43954401

43964402
// ~ deletes
4397-
mysql_dialect.verified_stmt("\
4398-
DELETE /*+ foobar */ FROM table_name");
4403+
mysql_dialect.verified_stmt(
4404+
"\
4405+
DELETE /*+ foobar */ FROM table_name",
4406+
);
43994407
}

tests/sqlparser_oracle.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -370,16 +370,13 @@ fn test_optimizer_hints() {
370370
);
371371

372372
// ~ inserts
373-
oracle_dialect.verified_stmt(
374-
"INSERT /*+ append */ INTO t1 SELECT * FROM all_objects");
373+
oracle_dialect.verified_stmt("INSERT /*+ append */ INTO t1 SELECT * FROM all_objects");
375374

376375
// ~ updates
377-
oracle_dialect.verified_stmt(
378-
"UPDATE /*+ DISABLE_PARALLEL_DML */ table_name SET column1 = 1");
376+
oracle_dialect.verified_stmt("UPDATE /*+ DISABLE_PARALLEL_DML */ table_name SET column1 = 1");
379377

380378
// ~ deletes
381-
oracle_dialect.verified_stmt(
382-
"DELETE --+ ENABLE_PARALLEL_DML\n FROM table_name");
379+
oracle_dialect.verified_stmt("DELETE --+ ENABLE_PARALLEL_DML\n FROM table_name");
383380

384381
// ~ merges
385382
oracle_dialect.verified_stmt(
@@ -388,5 +385,6 @@ fn test_optimizer_hints() {
388385
ON (pt.person_id = ps.person_id) \
389386
WHEN NOT MATCHED THEN INSERT \
390387
(pt.person_id, pt.first_name, pt.last_name, pt.title) \
391-
VALUES (ps.person_id, ps.first_name, ps.last_name, ps.title)");
388+
VALUES (ps.person_id, ps.first_name, ps.last_name, ps.title)",
389+
);
392390
}

0 commit comments

Comments
 (0)