mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-17 12:40:17 +00:00
Fix clippy lints (#287)
This commit is contained in:
parent
200ed5ecfc
commit
17f8eb9c5a
9 changed files with 38 additions and 30 deletions
|
@ -254,7 +254,7 @@ impl fmt::Display for ColumnOption {
|
|||
}
|
||||
}
|
||||
|
||||
fn display_constraint_name<'a>(name: &'a Option<Ident>) -> impl fmt::Display + 'a {
|
||||
fn display_constraint_name(name: &'_ Option<Ident>) -> impl fmt::Display + '_ {
|
||||
struct ConstraintName<'a>(&'a Option<Ident>);
|
||||
impl<'a> fmt::Display for ConstraintName<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
|
|
@ -346,7 +346,7 @@ impl fmt::Display for Join {
|
|||
_ => "",
|
||||
}
|
||||
}
|
||||
fn suffix<'a>(constraint: &'a JoinConstraint) -> impl fmt::Display + 'a {
|
||||
fn suffix(constraint: &'_ JoinConstraint) -> impl fmt::Display + '_ {
|
||||
struct Suffix<'a>(&'a JoinConstraint);
|
||||
impl<'a> fmt::Display for Suffix<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
|
|
@ -17,13 +17,13 @@ pub struct AnsiDialect {}
|
|||
|
||||
impl Dialect for AnsiDialect {
|
||||
fn is_identifier_start(&self, ch: char) -> bool {
|
||||
(ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')
|
||||
('a'..='z').contains(&ch) || ('A'..='Z').contains(&ch)
|
||||
}
|
||||
|
||||
fn is_identifier_part(&self, ch: char) -> bool {
|
||||
(ch >= 'a' && ch <= 'z')
|
||||
|| (ch >= 'A' && ch <= 'Z')
|
||||
|| (ch >= '0' && ch <= '9')
|
||||
('a'..='z').contains(&ch)
|
||||
|| ('A'..='Z').contains(&ch)
|
||||
|| ('0'..='9').contains(&ch)
|
||||
|| ch == '_'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,13 +17,17 @@ pub struct GenericDialect;
|
|||
|
||||
impl Dialect for GenericDialect {
|
||||
fn is_identifier_start(&self, ch: char) -> bool {
|
||||
(ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_' || ch == '#' || ch == '@'
|
||||
('a'..='z').contains(&ch)
|
||||
|| ('A'..='Z').contains(&ch)
|
||||
|| ch == '_'
|
||||
|| ch == '#'
|
||||
|| ch == '@'
|
||||
}
|
||||
|
||||
fn is_identifier_part(&self, ch: char) -> bool {
|
||||
(ch >= 'a' && ch <= 'z')
|
||||
|| (ch >= 'A' && ch <= 'Z')
|
||||
|| (ch >= '0' && ch <= '9')
|
||||
('a'..='z').contains(&ch)
|
||||
|| ('A'..='Z').contains(&ch)
|
||||
|| ('0'..='9').contains(&ch)
|
||||
|| ch == '@'
|
||||
|| ch == '$'
|
||||
|| ch == '#'
|
||||
|
|
|
@ -23,13 +23,17 @@ impl Dialect for MsSqlDialect {
|
|||
fn is_identifier_start(&self, ch: char) -> bool {
|
||||
// See https://docs.microsoft.com/en-us/sql/relational-databases/databases/database-identifiers?view=sql-server-2017#rules-for-regular-identifiers
|
||||
// We don't support non-latin "letters" currently.
|
||||
(ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_' || ch == '#' || ch == '@'
|
||||
('a'..='z').contains(&ch)
|
||||
|| ('A'..='Z').contains(&ch)
|
||||
|| ch == '_'
|
||||
|| ch == '#'
|
||||
|| ch == '@'
|
||||
}
|
||||
|
||||
fn is_identifier_part(&self, ch: char) -> bool {
|
||||
(ch >= 'a' && ch <= 'z')
|
||||
|| (ch >= 'A' && ch <= 'Z')
|
||||
|| (ch >= '0' && ch <= '9')
|
||||
('a'..='z').contains(&ch)
|
||||
|| ('A'..='Z').contains(&ch)
|
||||
|| ('0'..='9').contains(&ch)
|
||||
|| ch == '@'
|
||||
|| ch == '$'
|
||||
|| ch == '#'
|
||||
|
|
|
@ -20,15 +20,15 @@ impl Dialect for MySqlDialect {
|
|||
// See https://dev.mysql.com/doc/refman/8.0/en/identifiers.html.
|
||||
// We don't yet support identifiers beginning with numbers, as that
|
||||
// makes it hard to distinguish numeric literals.
|
||||
(ch >= 'a' && ch <= 'z')
|
||||
|| (ch >= 'A' && ch <= 'Z')
|
||||
('a'..='z').contains(&ch)
|
||||
|| ('A'..='Z').contains(&ch)
|
||||
|| ch == '_'
|
||||
|| ch == '$'
|
||||
|| (ch >= '\u{0080}' && ch <= '\u{ffff}')
|
||||
|| ('\u{0080}'..='\u{ffff}').contains(&ch)
|
||||
}
|
||||
|
||||
fn is_identifier_part(&self, ch: char) -> bool {
|
||||
self.is_identifier_start(ch) || (ch >= '0' && ch <= '9')
|
||||
self.is_identifier_start(ch) || ('0'..='9').contains(&ch)
|
||||
}
|
||||
|
||||
fn is_delimited_identifier_start(&self, ch: char) -> bool {
|
||||
|
|
|
@ -20,13 +20,13 @@ impl Dialect for PostgreSqlDialect {
|
|||
// See https://www.postgresql.org/docs/11/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
|
||||
// We don't yet support identifiers beginning with "letters with
|
||||
// diacritical marks and non-Latin letters"
|
||||
(ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_'
|
||||
('a'..='z').contains(&ch) || ('A'..='Z').contains(&ch) || ch == '_'
|
||||
}
|
||||
|
||||
fn is_identifier_part(&self, ch: char) -> bool {
|
||||
(ch >= 'a' && ch <= 'z')
|
||||
|| (ch >= 'A' && ch <= 'Z')
|
||||
|| (ch >= '0' && ch <= '9')
|
||||
('a'..='z').contains(&ch)
|
||||
|| ('A'..='Z').contains(&ch)
|
||||
|| ('0'..='9').contains(&ch)
|
||||
|| ch == '$'
|
||||
|| ch == '_'
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@ pub struct SnowflakeDialect;
|
|||
impl Dialect for SnowflakeDialect {
|
||||
// see https://docs.snowflake.com/en/sql-reference/identifiers-syntax.html
|
||||
fn is_identifier_start(&self, ch: char) -> bool {
|
||||
(ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_'
|
||||
('a'..='z').contains(&ch) || ('A'..='Z').contains(&ch) || ch == '_'
|
||||
}
|
||||
|
||||
fn is_identifier_part(&self, ch: char) -> bool {
|
||||
(ch >= 'a' && ch <= 'z')
|
||||
|| (ch >= 'A' && ch <= 'Z')
|
||||
|| (ch >= '0' && ch <= '9')
|
||||
('a'..='z').contains(&ch)
|
||||
|| ('A'..='Z').contains(&ch)
|
||||
|| ('0'..='9').contains(&ch)
|
||||
|| ch == '$'
|
||||
|| ch == '_'
|
||||
}
|
||||
|
|
|
@ -25,14 +25,14 @@ impl Dialect for SQLiteDialect {
|
|||
|
||||
fn is_identifier_start(&self, ch: char) -> bool {
|
||||
// See https://www.sqlite.org/draft/tokenreq.html
|
||||
(ch >= 'a' && ch <= 'z')
|
||||
|| (ch >= 'A' && ch <= 'Z')
|
||||
('a'..='z').contains(&ch)
|
||||
|| ('A'..='Z').contains(&ch)
|
||||
|| ch == '_'
|
||||
|| ch == '$'
|
||||
|| (ch >= '\u{007f}' && ch <= '\u{ffff}')
|
||||
|| ('\u{007f}'..='\u{ffff}').contains(&ch)
|
||||
}
|
||||
|
||||
fn is_identifier_part(&self, ch: char) -> bool {
|
||||
self.is_identifier_start(ch) || (ch >= '0' && ch <= '9')
|
||||
self.is_identifier_start(ch) || ('0'..='9').contains(&ch)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue