Skip to content

Commit f30ab89

Browse files
committed
Re-run cargo fmt
1 parent 23a0fc7 commit f30ab89

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

src/sqlast/mod.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,18 @@ impl ToString for SQLStatement {
348348
}
349349
s
350350
}
351-
SQLStatement::SQLCreateView { name, query, materialized } => {
351+
SQLStatement::SQLCreateView {
352+
name,
353+
query,
354+
materialized,
355+
} => {
352356
let modifier = if *materialized { " MATERIALIZED" } else { "" };
353-
format!("CREATE{} VIEW {} AS {}", modifier, name.to_string(), query.to_string())
357+
format!(
358+
"CREATE{} VIEW {} AS {}",
359+
modifier,
360+
name.to_string(),
361+
query.to_string()
362+
)
354363
}
355364
SQLStatement::SQLCreateTable { name, columns } => format!(
356365
"CREATE TABLE {} ({})",

src/sqlparser.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,11 @@ impl Parser {
640640
self.expect_keyword("AS")?;
641641
let query = self.parse_query()?;
642642
// Optional `WITH [ CASCADED | LOCAL ] CHECK OPTION` is widely supported here.
643-
Ok(SQLStatement::SQLCreateView { name, query, materialized })
643+
Ok(SQLStatement::SQLCreateView {
644+
name,
645+
query,
646+
materialized,
647+
})
644648
}
645649

646650
pub fn parse_create_table(&mut self) -> Result<SQLStatement, ParserError> {

tests/sqlparser_generic.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,11 @@ fn parse_scalar_subqueries() {
901901
fn parse_create_view() {
902902
let sql = "CREATE VIEW myschema.myview AS SELECT foo FROM bar";
903903
match verified_stmt(sql) {
904-
SQLStatement::SQLCreateView { name, query, materialized } => {
904+
SQLStatement::SQLCreateView {
905+
name,
906+
query,
907+
materialized,
908+
} => {
905909
assert_eq!("myschema.myview", name.to_string());
906910
assert_eq!("SELECT foo FROM bar", query.to_string());
907911
assert!(!materialized);
@@ -914,7 +918,11 @@ fn parse_create_view() {
914918
fn parse_create_materialized_view() {
915919
let sql = "CREATE MATERIALIZED VIEW myschema.myview AS SELECT foo FROM bar";
916920
match verified_stmt(sql) {
917-
SQLStatement::SQLCreateView { name, query, materialized } => {
921+
SQLStatement::SQLCreateView {
922+
name,
923+
query,
924+
materialized,
925+
} => {
918926
assert_eq!("myschema.myview", name.to_string());
919927
assert_eq!("SELECT foo FROM bar", query.to_string());
920928
assert!(materialized);

0 commit comments

Comments
 (0)