This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
The following commit(s) were added to refs/heads/main by this push:
new 6291afb2 Fix clippy warnings on rust 1.83 (#1570)
6291afb2 is described below
commit 6291afb2c75871edf34b3d2c01ef9249a5369c81
Author: Ifeanyi Ubah <[email protected]>
AuthorDate: Fri Nov 29 12:37:06 2024 +0100
Fix clippy warnings on rust 1.83 (#1570)
---
src/ast/ddl.rs | 13 ++++++++-----
src/ast/mod.rs | 2 +-
src/ast/query.rs | 2 +-
src/ast/value.rs | 6 +++---
src/parser/alter.rs | 2 +-
src/parser/mod.rs | 6 ++----
src/tokenizer.rs | 2 +-
7 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/src/ast/ddl.rs b/src/ast/ddl.rs
index 21a716d2..3ced478c 100644
--- a/src/ast/ddl.rs
+++ b/src/ast/ddl.rs
@@ -1327,15 +1327,18 @@ pub enum ColumnOption {
/// `DEFAULT <restricted-expr>`
Default(Expr),
- /// ClickHouse supports `MATERIALIZE`, `EPHEMERAL` and `ALIAS` expr to
generate default values.
+ /// `MATERIALIZE <expr>`
/// Syntax: `b INT MATERIALIZE (a + 1)`
+ ///
///
[ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/create/table#default_values)
-
- /// `MATERIALIZE <expr>`
Materialized(Expr),
/// `EPHEMERAL [<expr>]`
+ ///
+ ///
[ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/create/table#default_values)
Ephemeral(Option<Expr>),
/// `ALIAS <expr>`
+ ///
+ ///
[ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/create/table#default_values)
Alias(Expr),
/// `{ PRIMARY KEY | UNIQUE } [<constraint_characteristics>]`
@@ -1552,7 +1555,7 @@ pub enum GeneratedExpressionMode {
#[must_use]
fn display_constraint_name(name: &'_ Option<Ident>) -> impl fmt::Display + '_ {
struct ConstraintName<'a>(&'a Option<Ident>);
- impl<'a> fmt::Display for ConstraintName<'a> {
+ impl fmt::Display for ConstraintName<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if let Some(name) = self.0 {
write!(f, "CONSTRAINT {name} ")?;
@@ -1573,7 +1576,7 @@ fn display_option<'a, T: fmt::Display>(
option: &'a Option<T>,
) -> impl fmt::Display + 'a {
struct OptionDisplay<'a, T>(&'a str, &'a str, &'a Option<T>);
- impl<'a, T: fmt::Display> fmt::Display for OptionDisplay<'a, T> {
+ impl<T: fmt::Display> fmt::Display for OptionDisplay<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if let Some(inner) = self.2 {
let (prefix, postfix) = (self.0, self.1);
diff --git a/src/ast/mod.rs b/src/ast/mod.rs
index 366bf4d2..386e42fb 100644
--- a/src/ast/mod.rs
+++ b/src/ast/mod.rs
@@ -110,7 +110,7 @@ where
sep: &'static str,
}
-impl<'a, T> fmt::Display for DisplaySeparated<'a, T>
+impl<T> fmt::Display for DisplaySeparated<'_, T>
where
T: fmt::Display,
{
diff --git a/src/ast/query.rs b/src/ast/query.rs
index 0472026a..716ffe98 100644
--- a/src/ast/query.rs
+++ b/src/ast/query.rs
@@ -1713,7 +1713,7 @@ impl fmt::Display for Join {
}
fn suffix(constraint: &'_ JoinConstraint) -> impl fmt::Display + '_ {
struct Suffix<'a>(&'a JoinConstraint);
- impl<'a> fmt::Display for Suffix<'a> {
+ impl fmt::Display for Suffix<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.0 {
JoinConstraint::On(expr) => write!(f, " ON {expr}"),
diff --git a/src/ast/value.rs b/src/ast/value.rs
index 30d956a0..28bf89ba 100644
--- a/src/ast/value.rs
+++ b/src/ast/value.rs
@@ -261,7 +261,7 @@ pub struct EscapeQuotedString<'a> {
quote: char,
}
-impl<'a> fmt::Display for EscapeQuotedString<'a> {
+impl fmt::Display for EscapeQuotedString<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// EscapeQuotedString doesn't know which mode of escape was
// chosen by the user. So this code must to correctly display
@@ -325,7 +325,7 @@ pub fn escape_double_quote_string(s: &str) ->
EscapeQuotedString<'_> {
pub struct EscapeEscapedStringLiteral<'a>(&'a str);
-impl<'a> fmt::Display for EscapeEscapedStringLiteral<'a> {
+impl fmt::Display for EscapeEscapedStringLiteral<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for c in self.0.chars() {
match c {
@@ -359,7 +359,7 @@ pub fn escape_escaped_string(s: &str) ->
EscapeEscapedStringLiteral<'_> {
pub struct EscapeUnicodeStringLiteral<'a>(&'a str);
-impl<'a> fmt::Display for EscapeUnicodeStringLiteral<'a> {
+impl fmt::Display for EscapeUnicodeStringLiteral<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for c in self.0.chars() {
match c {
diff --git a/src/parser/alter.rs b/src/parser/alter.rs
index 53410579..3ac4ab0c 100644
--- a/src/parser/alter.rs
+++ b/src/parser/alter.rs
@@ -26,7 +26,7 @@ use crate::{
tokenizer::Token,
};
-impl<'a> Parser<'a> {
+impl Parser<'_> {
pub fn parse_alter_role(&mut self) -> Result<Statement, ParserError> {
if dialect_of!(self is PostgreSqlDialect) {
return self.parse_pg_alter_role();
diff --git a/src/parser/mod.rs b/src/parser/mod.rs
index b7f5cb86..fe6fae8b 100644
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -10883,13 +10883,12 @@ impl<'a> Parser<'a> {
Ok(ExprWithAlias { expr, alias })
}
/// Parses an expression with an optional alias
-
+ ///
/// Examples:
-
+ ///
/// ```sql
/// SUM(price) AS total_price
/// ```
-
/// ```sql
/// SUM(price)
/// ```
@@ -10905,7 +10904,6 @@ impl<'a> Parser<'a> {
/// assert_eq!(Some("b".to_string()),
expr_with_alias.alias.map(|x|x.value));
/// # Ok(())
/// # }
-
pub fn parse_expr_with_alias(&mut self) -> Result<ExprWithAlias,
ParserError> {
let expr = self.parse_expr()?;
let alias = if self.parse_keyword(Keyword::AS) {
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index a57ba2ec..bed2d9b5 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -584,7 +584,7 @@ struct State<'a> {
pub col: u64,
}
-impl<'a> State<'a> {
+impl State<'_> {
/// return the next character and advance the stream
pub fn next(&mut self) -> Option<char> {
match self.peekable.next() {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]