File tree Expand file tree Collapse file tree 14 files changed +37
-62
lines changed Expand file tree Collapse file tree 14 files changed +37
-62
lines changed Original file line number Diff line number Diff line change @@ -1786,7 +1786,7 @@ impl fmt::Display for Statement {
17861786 Statement :: SetVariable { key_values } => {
17871787 f. write_str ( "SET " ) ?;
17881788
1789- if let Some ( key_value) = key_values. get ( 0 ) {
1789+ if let Some ( key_value) = key_values. first ( ) {
17901790 if key_value. hivevar {
17911791 let values: Vec < String > = key_value
17921792 . value
Original file line number Diff line number Diff line change @@ -17,13 +17,10 @@ pub struct AnsiDialect {}
1717
1818impl Dialect for AnsiDialect {
1919 fn is_identifier_start ( & self , ch : char ) -> bool {
20- ( 'a' ..= 'z' ) . contains ( & ch ) || ( 'A' ..= 'Z' ) . contains ( & ch )
20+ ch . is_ascii_lowercase ( ) || ch . is_ascii_uppercase ( )
2121 }
2222
2323 fn is_identifier_part ( & self , ch : char ) -> bool {
24- ( 'a' ..='z' ) . contains ( & ch)
25- || ( 'A' ..='Z' ) . contains ( & ch)
26- || ( '0' ..='9' ) . contains ( & ch)
27- || ch == '_'
24+ ch. is_ascii_lowercase ( ) || ch. is_ascii_uppercase ( ) || ch. is_ascii_digit ( ) || ch == '_'
2825 }
2926}
Original file line number Diff line number Diff line change @@ -18,10 +18,10 @@ pub struct ClickHouseDialect {}
1818impl Dialect for ClickHouseDialect {
1919 fn is_identifier_start ( & self , ch : char ) -> bool {
2020 // See https://clickhouse.com/docs/en/sql-reference/syntax/#syntax-identifiers
21- ( 'a' ..= 'z' ) . contains ( & ch ) || ( 'A' ..= 'Z' ) . contains ( & ch ) || ch == '_'
21+ ch . is_ascii_lowercase ( ) || ch . is_ascii_uppercase ( ) || ch == '_'
2222 }
2323
2424 fn is_identifier_part ( & self , ch : char ) -> bool {
25- self . is_identifier_start ( ch) || ( '0' ..= '9' ) . contains ( & ch )
25+ self . is_identifier_start ( ch) || ch . is_ascii_digit ( )
2626 }
2727}
Original file line number Diff line number Diff line change @@ -17,17 +17,13 @@ pub struct GenericDialect;
1717
1818impl Dialect for GenericDialect {
1919 fn is_identifier_start ( & self , ch : char ) -> bool {
20- ( 'a' ..='z' ) . contains ( & ch)
21- || ( 'A' ..='Z' ) . contains ( & ch)
22- || ch == '_'
23- || ch == '#'
24- || ch == '@'
20+ ch. is_ascii_lowercase ( ) || ch. is_ascii_uppercase ( ) || ch == '_' || ch == '#' || ch == '@'
2521 }
2622
2723 fn is_identifier_part ( & self , ch : char ) -> bool {
28- ( 'a' ..= 'z' ) . contains ( & ch )
29- || ( 'A' ..= 'Z' ) . contains ( & ch )
30- || ( '0' ..= '9' ) . contains ( & ch )
24+ ch . is_ascii_lowercase ( )
25+ || ch . is_ascii_uppercase ( )
26+ || ch . is_ascii_digit ( )
3127 || ch == '@'
3228 || ch == '$'
3329 || ch == '#'
Original file line number Diff line number Diff line change @@ -21,16 +21,13 @@ impl Dialect for HiveDialect {
2121 }
2222
2323 fn is_identifier_start ( & self , ch : char ) -> bool {
24- ( 'a' ..='z' ) . contains ( & ch)
25- || ( 'A' ..='Z' ) . contains ( & ch)
26- || ( '0' ..='9' ) . contains ( & ch)
27- || ch == '$'
24+ ch. is_ascii_lowercase ( ) || ch. is_ascii_uppercase ( ) || ch. is_ascii_digit ( ) || ch == '$'
2825 }
2926
3027 fn is_identifier_part ( & self , ch : char ) -> bool {
31- ( 'a' ..= 'z' ) . contains ( & ch )
32- || ( 'A' ..= 'Z' ) . contains ( & ch )
33- || ( '0' ..= '9' ) . contains ( & ch )
28+ ch . is_ascii_lowercase ( )
29+ || ch . is_ascii_uppercase ( )
30+ || ch . is_ascii_digit ( )
3431 || ch == '_'
3532 || ch == '$'
3633 || ch == '{'
Original file line number Diff line number Diff line change @@ -23,17 +23,13 @@ impl Dialect for MsSqlDialect {
2323 fn is_identifier_start ( & self , ch : char ) -> bool {
2424 // See https://docs.microsoft.com/en-us/sql/relational-databases/databases/database-identifiers?view=sql-server-2017#rules-for-regular-identifiers
2525 // We don't support non-latin "letters" currently.
26- ( 'a' ..='z' ) . contains ( & ch)
27- || ( 'A' ..='Z' ) . contains ( & ch)
28- || ch == '_'
29- || ch == '#'
30- || ch == '@'
26+ ch. is_ascii_lowercase ( ) || ch. is_ascii_uppercase ( ) || ch == '_' || ch == '#' || ch == '@'
3127 }
3228
3329 fn is_identifier_part ( & self , ch : char ) -> bool {
34- ( 'a' ..= 'z' ) . contains ( & ch )
35- || ( 'A' ..= 'Z' ) . contains ( & ch )
36- || ( '0' ..= '9' ) . contains ( & ch )
30+ ch . is_ascii_lowercase ( )
31+ || ch . is_ascii_uppercase ( )
32+ || ch . is_ascii_digit ( )
3733 || ch == '@'
3834 || ch == '$'
3935 || ch == '#'
Original file line number Diff line number Diff line change @@ -20,16 +20,16 @@ impl Dialect for MySqlDialect {
2020 // See https://dev.mysql.com/doc/refman/8.0/en/identifiers.html.
2121 // We don't yet support identifiers beginning with numbers, as that
2222 // makes it hard to distinguish numeric literals.
23- ( 'a' ..= 'z' ) . contains ( & ch )
24- || ( 'A' ..= 'Z' ) . contains ( & ch )
23+ ch . is_ascii_lowercase ( )
24+ || ch . is_ascii_uppercase ( )
2525 || ch == '_'
2626 || ch == '$'
2727 || ch == '@'
2828 || ( '\u{0080}' ..='\u{ffff}' ) . contains ( & ch)
2929 }
3030
3131 fn is_identifier_part ( & self , ch : char ) -> bool {
32- self . is_identifier_start ( ch) || ( '0' ..= '9' ) . contains ( & ch )
32+ self . is_identifier_start ( ch) || ch . is_ascii_digit ( )
3333 }
3434
3535 fn is_delimited_identifier_start ( & self , ch : char ) -> bool {
Original file line number Diff line number Diff line change @@ -20,13 +20,13 @@ impl Dialect for PostgreSqlDialect {
2020 // See https://www.postgresql.org/docs/11/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
2121 // We don't yet support identifiers beginning with "letters with
2222 // diacritical marks and non-Latin letters"
23- ( 'a' ..= 'z' ) . contains ( & ch ) || ( 'A' ..= 'Z' ) . contains ( & ch ) || ch == '_'
23+ ch . is_ascii_lowercase ( ) || ch . is_ascii_uppercase ( ) || ch == '_'
2424 }
2525
2626 fn is_identifier_part ( & self , ch : char ) -> bool {
27- ( 'a' ..= 'z' ) . contains ( & ch )
28- || ( 'A' ..= 'Z' ) . contains ( & ch )
29- || ( '0' ..= '9' ) . contains ( & ch )
27+ ch . is_ascii_lowercase ( )
28+ || ch . is_ascii_uppercase ( )
29+ || ch . is_ascii_digit ( )
3030 || ch == '$'
3131 || ch == '_'
3232 }
Original file line number Diff line number Diff line change @@ -18,13 +18,13 @@ pub struct SnowflakeDialect;
1818impl Dialect for SnowflakeDialect {
1919 // see https://docs.snowflake.com/en/sql-reference/identifiers-syntax.html
2020 fn is_identifier_start ( & self , ch : char ) -> bool {
21- ( 'a' ..= 'z' ) . contains ( & ch ) || ( 'A' ..= 'Z' ) . contains ( & ch ) || ch == '_'
21+ ch . is_ascii_lowercase ( ) || ch . is_ascii_uppercase ( ) || ch == '_'
2222 }
2323
2424 fn is_identifier_part ( & self , ch : char ) -> bool {
25- ( 'a' ..= 'z' ) . contains ( & ch )
26- || ( 'A' ..= 'Z' ) . contains ( & ch )
27- || ( '0' ..= '9' ) . contains ( & ch )
25+ ch . is_ascii_lowercase ( )
26+ || ch . is_ascii_uppercase ( )
27+ || ch . is_ascii_digit ( )
2828 || ch == '$'
2929 || ch == '_'
3030 }
Original file line number Diff line number Diff line change @@ -25,14 +25,14 @@ impl Dialect for SQLiteDialect {
2525
2626 fn is_identifier_start ( & self , ch : char ) -> bool {
2727 // See https://www.sqlite.org/draft/tokenreq.html
28- ( 'a' ..= 'z' ) . contains ( & ch )
29- || ( 'A' ..= 'Z' ) . contains ( & ch )
28+ ch . is_ascii_lowercase ( )
29+ || ch . is_ascii_uppercase ( )
3030 || ch == '_'
3131 || ch == '$'
3232 || ( '\u{007f}' ..='\u{ffff}' ) . contains ( & ch)
3333 }
3434
3535 fn is_identifier_part ( & self , ch : char ) -> bool {
36- self . is_identifier_start ( ch) || ( '0' ..= '9' ) . contains ( & ch )
36+ self . is_identifier_start ( ch) || ch . is_ascii_digit ( )
3737 }
3838}
You can’t perform that action at this time.
0 commit comments