From f30ab89ad289f50084f68824e3aaa8abb945e5b4 Mon Sep 17 00:00:00 2001 From: Nickolay Ponomarev Date: Fri, 8 Mar 2019 15:46:40 +0300 Subject: [PATCH] Re-run cargo fmt --- src/sqlast/mod.rs | 13 +++++++++++-- src/sqlparser.rs | 6 +++++- tests/sqlparser_generic.rs | 12 ++++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/sqlast/mod.rs b/src/sqlast/mod.rs index a37a171c..fe30586b 100644 --- a/src/sqlast/mod.rs +++ b/src/sqlast/mod.rs @@ -348,9 +348,18 @@ impl ToString for SQLStatement { } s } - SQLStatement::SQLCreateView { name, query, materialized } => { + SQLStatement::SQLCreateView { + name, + query, + materialized, + } => { let modifier = if *materialized { " MATERIALIZED" } else { "" }; - format!("CREATE{} VIEW {} AS {}", modifier, name.to_string(), query.to_string()) + format!( + "CREATE{} VIEW {} AS {}", + modifier, + name.to_string(), + query.to_string() + ) } SQLStatement::SQLCreateTable { name, columns } => format!( "CREATE TABLE {} ({})", diff --git a/src/sqlparser.rs b/src/sqlparser.rs index 6b199724..22d0e70c 100644 --- a/src/sqlparser.rs +++ b/src/sqlparser.rs @@ -640,7 +640,11 @@ impl Parser { self.expect_keyword("AS")?; let query = self.parse_query()?; // Optional `WITH [ CASCADED | LOCAL ] CHECK OPTION` is widely supported here. - Ok(SQLStatement::SQLCreateView { name, query, materialized }) + Ok(SQLStatement::SQLCreateView { + name, + query, + materialized, + }) } pub fn parse_create_table(&mut self) -> Result { diff --git a/tests/sqlparser_generic.rs b/tests/sqlparser_generic.rs index bbfeb447..b3e418a0 100644 --- a/tests/sqlparser_generic.rs +++ b/tests/sqlparser_generic.rs @@ -901,7 +901,11 @@ fn parse_scalar_subqueries() { fn parse_create_view() { let sql = "CREATE VIEW myschema.myview AS SELECT foo FROM bar"; match verified_stmt(sql) { - SQLStatement::SQLCreateView { name, query, materialized } => { + SQLStatement::SQLCreateView { + name, + query, + materialized, + } => { assert_eq!("myschema.myview", name.to_string()); assert_eq!("SELECT foo FROM bar", query.to_string()); assert!(!materialized); @@ -914,7 +918,11 @@ fn parse_create_view() { fn parse_create_materialized_view() { let sql = "CREATE MATERIALIZED VIEW myschema.myview AS SELECT foo FROM bar"; match verified_stmt(sql) { - SQLStatement::SQLCreateView { name, query, materialized } => { + SQLStatement::SQLCreateView { + name, + query, + materialized, + } => { assert_eq!("myschema.myview", name.to_string()); assert_eq!("SELECT foo FROM bar", query.to_string()); assert!(materialized);