Skip to content

Commit 17f8eb9

Browse files
authored
Fix clippy lints (#287)
1 parent 200ed5e commit 17f8eb9

File tree

9 files changed

+38
-30
lines changed

9 files changed

+38
-30
lines changed

src/ast/ddl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl fmt::Display for ColumnOption {
254254
}
255255
}
256256

257-
fn display_constraint_name<'a>(name: &'a Option<Ident>) -> impl fmt::Display + 'a {
257+
fn display_constraint_name(name: &'_ Option<Ident>) -> impl fmt::Display + '_ {
258258
struct ConstraintName<'a>(&'a Option<Ident>);
259259
impl<'a> fmt::Display for ConstraintName<'a> {
260260
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

src/ast/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ impl fmt::Display for Join {
346346
_ => "",
347347
}
348348
}
349-
fn suffix<'a>(constraint: &'a JoinConstraint) -> impl fmt::Display + 'a {
349+
fn suffix(constraint: &'_ JoinConstraint) -> impl fmt::Display + '_ {
350350
struct Suffix<'a>(&'a JoinConstraint);
351351
impl<'a> fmt::Display for Suffix<'a> {
352352
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

src/dialect/ansi.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ pub struct AnsiDialect {}
1717

1818
impl Dialect for AnsiDialect {
1919
fn is_identifier_start(&self, ch: char) -> bool {
20-
(ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')
20+
('a'..='z').contains(&ch) || ('A'..='Z').contains(&ch)
2121
}
2222

2323
fn is_identifier_part(&self, ch: char) -> bool {
24-
(ch >= 'a' && ch <= 'z')
25-
|| (ch >= 'A' && ch <= 'Z')
26-
|| (ch >= '0' && ch <= '9')
24+
('a'..='z').contains(&ch)
25+
|| ('A'..='Z').contains(&ch)
26+
|| ('0'..='9').contains(&ch)
2727
|| ch == '_'
2828
}
2929
}

src/dialect/generic.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ pub struct GenericDialect;
1717

1818
impl Dialect for GenericDialect {
1919
fn is_identifier_start(&self, ch: char) -> bool {
20-
(ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_' || ch == '#' || ch == '@'
20+
('a'..='z').contains(&ch)
21+
|| ('A'..='Z').contains(&ch)
22+
|| ch == '_'
23+
|| ch == '#'
24+
|| ch == '@'
2125
}
2226

2327
fn is_identifier_part(&self, ch: char) -> bool {
24-
(ch >= 'a' && ch <= 'z')
25-
|| (ch >= 'A' && ch <= 'Z')
26-
|| (ch >= '0' && ch <= '9')
28+
('a'..='z').contains(&ch)
29+
|| ('A'..='Z').contains(&ch)
30+
|| ('0'..='9').contains(&ch)
2731
|| ch == '@'
2832
|| ch == '$'
2933
|| ch == '#'

src/dialect/mssql.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@ 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-
(ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_' || ch == '#' || ch == '@'
26+
('a'..='z').contains(&ch)
27+
|| ('A'..='Z').contains(&ch)
28+
|| ch == '_'
29+
|| ch == '#'
30+
|| ch == '@'
2731
}
2832

2933
fn is_identifier_part(&self, ch: char) -> bool {
30-
(ch >= 'a' && ch <= 'z')
31-
|| (ch >= 'A' && ch <= 'Z')
32-
|| (ch >= '0' && ch <= '9')
34+
('a'..='z').contains(&ch)
35+
|| ('A'..='Z').contains(&ch)
36+
|| ('0'..='9').contains(&ch)
3337
|| ch == '@'
3438
|| ch == '$'
3539
|| ch == '#'

src/dialect/mysql.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ 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-
(ch >= 'a' && ch <= 'z')
24-
|| (ch >= 'A' && ch <= 'Z')
23+
('a'..='z').contains(&ch)
24+
|| ('A'..='Z').contains(&ch)
2525
|| ch == '_'
2626
|| ch == '$'
27-
|| (ch >= '\u{0080}' && ch <= '\u{ffff}')
27+
|| ('\u{0080}'..='\u{ffff}').contains(&ch)
2828
}
2929

3030
fn is_identifier_part(&self, ch: char) -> bool {
31-
self.is_identifier_start(ch) || (ch >= '0' && ch <= '9')
31+
self.is_identifier_start(ch) || ('0'..='9').contains(&ch)
3232
}
3333

3434
fn is_delimited_identifier_start(&self, ch: char) -> bool {

src/dialect/postgresql.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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-
(ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_'
23+
('a'..='z').contains(&ch) || ('A'..='Z').contains(&ch) || ch == '_'
2424
}
2525

2626
fn is_identifier_part(&self, ch: char) -> bool {
27-
(ch >= 'a' && ch <= 'z')
28-
|| (ch >= 'A' && ch <= 'Z')
29-
|| (ch >= '0' && ch <= '9')
27+
('a'..='z').contains(&ch)
28+
|| ('A'..='Z').contains(&ch)
29+
|| ('0'..='9').contains(&ch)
3030
|| ch == '$'
3131
|| ch == '_'
3232
}

src/dialect/snowflake.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ pub struct SnowflakeDialect;
1818
impl 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-
(ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_'
21+
('a'..='z').contains(&ch) || ('A'..='Z').contains(&ch) || ch == '_'
2222
}
2323

2424
fn is_identifier_part(&self, ch: char) -> bool {
25-
(ch >= 'a' && ch <= 'z')
26-
|| (ch >= 'A' && ch <= 'Z')
27-
|| (ch >= '0' && ch <= '9')
25+
('a'..='z').contains(&ch)
26+
|| ('A'..='Z').contains(&ch)
27+
|| ('0'..='9').contains(&ch)
2828
|| ch == '$'
2929
|| ch == '_'
3030
}

src/dialect/sqlite.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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-
(ch >= 'a' && ch <= 'z')
29-
|| (ch >= 'A' && ch <= 'Z')
28+
('a'..='z').contains(&ch)
29+
|| ('A'..='Z').contains(&ch)
3030
|| ch == '_'
3131
|| ch == '$'
32-
|| (ch >= '\u{007f}' && ch <= '\u{ffff}')
32+
|| ('\u{007f}'..='\u{ffff}').contains(&ch)
3333
}
3434

3535
fn is_identifier_part(&self, ch: char) -> bool {
36-
self.is_identifier_start(ch) || (ch >= '0' && ch <= '9')
36+
self.is_identifier_start(ch) || ('0'..='9').contains(&ch)
3737
}
3838
}

0 commit comments

Comments
 (0)