mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-12 23:12:01 +00:00
Fix clippy lints on 1.88.0 (#1910)
This commit is contained in:
parent
95d16e3b2d
commit
5f2b5fe7be
26 changed files with 226 additions and 232 deletions
|
@ -357,7 +357,7 @@ impl ObjectNamePart {
|
|||
impl fmt::Display for ObjectNamePart {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
ObjectNamePart::Identifier(ident) => write!(f, "{}", ident),
|
||||
ObjectNamePart::Identifier(ident) => write!(f, "{ident}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1210,8 +1210,8 @@ pub enum AccessExpr {
|
|||
impl fmt::Display for AccessExpr {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
AccessExpr::Dot(expr) => write!(f, ".{}", expr),
|
||||
AccessExpr::Subscript(subscript) => write!(f, "[{}]", subscript),
|
||||
AccessExpr::Dot(expr) => write!(f, ".{expr}"),
|
||||
AccessExpr::Subscript(subscript) => write!(f, "[{subscript}]"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1413,12 +1413,12 @@ impl fmt::Display for Expr {
|
|||
match self {
|
||||
Expr::Identifier(s) => write!(f, "{s}"),
|
||||
Expr::Wildcard(_) => f.write_str("*"),
|
||||
Expr::QualifiedWildcard(prefix, _) => write!(f, "{}.*", prefix),
|
||||
Expr::QualifiedWildcard(prefix, _) => write!(f, "{prefix}.*"),
|
||||
Expr::CompoundIdentifier(s) => write!(f, "{}", display_separated(s, ".")),
|
||||
Expr::CompoundFieldAccess { root, access_chain } => {
|
||||
write!(f, "{}", root)?;
|
||||
write!(f, "{root}")?;
|
||||
for field in access_chain {
|
||||
write!(f, "{}", field)?;
|
||||
write!(f, "{field}")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -1547,7 +1547,7 @@ impl fmt::Display for Expr {
|
|||
} => {
|
||||
let not_ = if *negated { "NOT " } else { "" };
|
||||
if form.is_none() {
|
||||
write!(f, "{} IS {}NORMALIZED", expr, not_)
|
||||
write!(f, "{expr} IS {not_}NORMALIZED")
|
||||
} else {
|
||||
write!(
|
||||
f,
|
||||
|
@ -1869,7 +1869,7 @@ impl fmt::Display for Expr {
|
|||
}
|
||||
}
|
||||
Expr::Named { expr, name } => {
|
||||
write!(f, "{} AS {}", expr, name)
|
||||
write!(f, "{expr} AS {name}")
|
||||
}
|
||||
Expr::Dictionary(fields) => {
|
||||
write!(f, "{{{}}}", display_comma_separated(fields))
|
||||
|
@ -2425,7 +2425,7 @@ impl fmt::Display for ConditionalStatements {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
ConditionalStatements::BeginEnd(bes) => write!(f, "{}", bes),
|
||||
ConditionalStatements::BeginEnd(bes) => write!(f, "{bes}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2945,9 +2945,7 @@ impl Display for Set {
|
|||
write!(
|
||||
f,
|
||||
"SET {modifier}ROLE {role_name}",
|
||||
modifier = context_modifier
|
||||
.map(|m| format!("{}", m))
|
||||
.unwrap_or_default()
|
||||
modifier = context_modifier.map(|m| format!("{m}")).unwrap_or_default()
|
||||
)
|
||||
}
|
||||
Self::SetSessionParam(kind) => write!(f, "SET {kind}"),
|
||||
|
@ -2980,7 +2978,7 @@ impl Display for Set {
|
|||
charset_name,
|
||||
collation_name,
|
||||
} => {
|
||||
write!(f, "SET NAMES {}", charset_name)?;
|
||||
write!(f, "SET NAMES {charset_name}")?;
|
||||
|
||||
if let Some(collation) = collation_name {
|
||||
f.write_str(" COLLATE ")?;
|
||||
|
@ -3003,7 +3001,7 @@ impl Display for Set {
|
|||
write!(
|
||||
f,
|
||||
"SET {}{}{} = {}",
|
||||
scope.map(|s| format!("{}", s)).unwrap_or_default(),
|
||||
scope.map(|s| format!("{s}")).unwrap_or_default(),
|
||||
if *hivevar { "HIVEVAR:" } else { "" },
|
||||
variable,
|
||||
display_comma_separated(values)
|
||||
|
@ -4405,7 +4403,7 @@ impl fmt::Display for Statement {
|
|||
write!(f, "{describe_alias} ")?;
|
||||
|
||||
if let Some(format) = hive_format {
|
||||
write!(f, "{} ", format)?;
|
||||
write!(f, "{format} ")?;
|
||||
}
|
||||
if *has_table_keyword {
|
||||
write!(f, "TABLE ")?;
|
||||
|
@ -5241,7 +5239,7 @@ impl fmt::Display for Statement {
|
|||
if *only {
|
||||
write!(f, "ONLY ")?;
|
||||
}
|
||||
write!(f, "{name} ", name = name)?;
|
||||
write!(f, "{name} ")?;
|
||||
if let Some(cluster) = on_cluster {
|
||||
write!(f, "ON CLUSTER {cluster} ")?;
|
||||
}
|
||||
|
@ -5319,7 +5317,7 @@ impl fmt::Display for Statement {
|
|||
)?;
|
||||
if !session_params.options.is_empty() {
|
||||
if *set {
|
||||
write!(f, " {}", session_params)?;
|
||||
write!(f, " {session_params}")?;
|
||||
} else {
|
||||
let options = session_params
|
||||
.options
|
||||
|
@ -5353,7 +5351,7 @@ impl fmt::Display for Statement {
|
|||
if *purge { " PURGE" } else { "" },
|
||||
)?;
|
||||
if let Some(table_name) = table.as_ref() {
|
||||
write!(f, " ON {}", table_name)?;
|
||||
write!(f, " ON {table_name}")?;
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
@ -5608,7 +5606,7 @@ impl fmt::Display for Statement {
|
|||
} => {
|
||||
if *syntax_begin {
|
||||
if let Some(modifier) = *modifier {
|
||||
write!(f, "BEGIN {}", modifier)?;
|
||||
write!(f, "BEGIN {modifier}")?;
|
||||
} else {
|
||||
write!(f, "BEGIN")?;
|
||||
}
|
||||
|
@ -5644,7 +5642,7 @@ impl fmt::Display for Statement {
|
|||
if *end_syntax {
|
||||
write!(f, "END")?;
|
||||
if let Some(modifier) = *modifier {
|
||||
write!(f, " {}", modifier)?;
|
||||
write!(f, " {modifier}")?;
|
||||
}
|
||||
if *chain {
|
||||
write!(f, " AND CHAIN")?;
|
||||
|
@ -5743,7 +5741,7 @@ impl fmt::Display for Statement {
|
|||
write!(f, " GRANTED BY {grantor}")?;
|
||||
}
|
||||
if let Some(cascade) = cascade {
|
||||
write!(f, " {}", cascade)?;
|
||||
write!(f, " {cascade}")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -5922,13 +5920,13 @@ impl fmt::Display for Statement {
|
|||
if_not_exists = if *if_not_exists { "IF NOT EXISTS " } else { "" },
|
||||
)?;
|
||||
if !directory_table_params.options.is_empty() {
|
||||
write!(f, " DIRECTORY=({})", directory_table_params)?;
|
||||
write!(f, " DIRECTORY=({directory_table_params})")?;
|
||||
}
|
||||
if !file_format.options.is_empty() {
|
||||
write!(f, " FILE_FORMAT=({})", file_format)?;
|
||||
write!(f, " FILE_FORMAT=({file_format})")?;
|
||||
}
|
||||
if !copy_options.options.is_empty() {
|
||||
write!(f, " COPY_OPTIONS=({})", copy_options)?;
|
||||
write!(f, " COPY_OPTIONS=({copy_options})")?;
|
||||
}
|
||||
if comment.is_some() {
|
||||
write!(f, " COMMENT='{}'", comment.as_ref().unwrap())?;
|
||||
|
@ -5951,7 +5949,7 @@ impl fmt::Display for Statement {
|
|||
validation_mode,
|
||||
partition,
|
||||
} => {
|
||||
write!(f, "COPY INTO {}", into)?;
|
||||
write!(f, "COPY INTO {into}")?;
|
||||
if let Some(into_columns) = into_columns {
|
||||
write!(f, " ({})", display_comma_separated(into_columns))?;
|
||||
}
|
||||
|
@ -5967,12 +5965,12 @@ impl fmt::Display for Statement {
|
|||
)?;
|
||||
}
|
||||
if let Some(from_obj_alias) = from_obj_alias {
|
||||
write!(f, " AS {}", from_obj_alias)?;
|
||||
write!(f, " AS {from_obj_alias}")?;
|
||||
}
|
||||
write!(f, ")")?;
|
||||
} else if let Some(from_obj) = from_obj {
|
||||
// Standard data load
|
||||
write!(f, " FROM {}{}", from_obj, stage_params)?;
|
||||
write!(f, " FROM {from_obj}{stage_params}")?;
|
||||
if let Some(from_obj_alias) = from_obj_alias {
|
||||
write!(f, " AS {from_obj_alias}")?;
|
||||
}
|
||||
|
@ -5985,24 +5983,24 @@ impl fmt::Display for Statement {
|
|||
write!(f, " FILES = ('{}')", display_separated(files, "', '"))?;
|
||||
}
|
||||
if let Some(pattern) = pattern {
|
||||
write!(f, " PATTERN = '{}'", pattern)?;
|
||||
write!(f, " PATTERN = '{pattern}'")?;
|
||||
}
|
||||
if let Some(partition) = partition {
|
||||
write!(f, " PARTITION BY {partition}")?;
|
||||
}
|
||||
if !file_format.options.is_empty() {
|
||||
write!(f, " FILE_FORMAT=({})", file_format)?;
|
||||
write!(f, " FILE_FORMAT=({file_format})")?;
|
||||
}
|
||||
if !copy_options.options.is_empty() {
|
||||
match kind {
|
||||
CopyIntoSnowflakeKind::Table => {
|
||||
write!(f, " COPY_OPTIONS=({})", copy_options)?
|
||||
write!(f, " COPY_OPTIONS=({copy_options})")?
|
||||
}
|
||||
CopyIntoSnowflakeKind::Location => write!(f, " {copy_options}")?,
|
||||
}
|
||||
}
|
||||
if let Some(validation_mode) = validation_mode {
|
||||
write!(f, " VALIDATION_MODE = {}", validation_mode)?;
|
||||
write!(f, " VALIDATION_MODE = {validation_mode}")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -6048,10 +6046,10 @@ impl fmt::Display for Statement {
|
|||
} => {
|
||||
write!(f, "OPTIMIZE TABLE {name}")?;
|
||||
if let Some(on_cluster) = on_cluster {
|
||||
write!(f, " ON CLUSTER {on_cluster}", on_cluster = on_cluster)?;
|
||||
write!(f, " ON CLUSTER {on_cluster}")?;
|
||||
}
|
||||
if let Some(partition) = partition {
|
||||
write!(f, " {partition}", partition = partition)?;
|
||||
write!(f, " {partition}")?;
|
||||
}
|
||||
if *include_final {
|
||||
write!(f, " FINAL")?;
|
||||
|
@ -6178,7 +6176,7 @@ impl fmt::Display for SetAssignment {
|
|||
write!(
|
||||
f,
|
||||
"{}{} = {}",
|
||||
self.scope.map(|s| format!("{}", s)).unwrap_or_default(),
|
||||
self.scope.map(|s| format!("{s}")).unwrap_or_default(),
|
||||
self.name,
|
||||
self.value
|
||||
)
|
||||
|
@ -6907,7 +6905,7 @@ impl fmt::Display for GranteeName {
|
|||
match self {
|
||||
GranteeName::ObjectName(name) => name.fmt(f),
|
||||
GranteeName::UserHost { user, host } => {
|
||||
write!(f, "{}@{}", user, host)
|
||||
write!(f, "{user}@{host}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7077,7 +7075,7 @@ pub enum AssignmentTarget {
|
|||
impl fmt::Display for AssignmentTarget {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
AssignmentTarget::ColumnName(column) => write!(f, "{}", column),
|
||||
AssignmentTarget::ColumnName(column) => write!(f, "{column}"),
|
||||
AssignmentTarget::Tuple(columns) => write!(f, "({})", display_comma_separated(columns)),
|
||||
}
|
||||
}
|
||||
|
@ -7322,8 +7320,8 @@ impl fmt::Display for FunctionArguments {
|
|||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
FunctionArguments::None => Ok(()),
|
||||
FunctionArguments::Subquery(query) => write!(f, "({})", query),
|
||||
FunctionArguments::List(args) => write!(f, "({})", args),
|
||||
FunctionArguments::Subquery(query) => write!(f, "({query})"),
|
||||
FunctionArguments::List(args) => write!(f, "({args})"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7344,7 +7342,7 @@ pub struct FunctionArgumentList {
|
|||
impl fmt::Display for FunctionArgumentList {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
if let Some(duplicate_treatment) = self.duplicate_treatment {
|
||||
write!(f, "{} ", duplicate_treatment)?;
|
||||
write!(f, "{duplicate_treatment} ")?;
|
||||
}
|
||||
write!(f, "{}", display_comma_separated(&self.args))?;
|
||||
if !self.clauses.is_empty() {
|
||||
|
@ -7404,7 +7402,7 @@ impl fmt::Display for FunctionArgumentClause {
|
|||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
FunctionArgumentClause::IgnoreOrRespectNulls(null_treatment) => {
|
||||
write!(f, "{}", null_treatment)
|
||||
write!(f, "{null_treatment}")
|
||||
}
|
||||
FunctionArgumentClause::OrderBy(order_by) => {
|
||||
write!(f, "ORDER BY {}", display_comma_separated(order_by))
|
||||
|
@ -7860,12 +7858,12 @@ pub enum SqlOption {
|
|||
impl fmt::Display for SqlOption {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
SqlOption::Clustered(c) => write!(f, "{}", c),
|
||||
SqlOption::Clustered(c) => write!(f, "{c}"),
|
||||
SqlOption::Ident(ident) => {
|
||||
write!(f, "{}", ident)
|
||||
write!(f, "{ident}")
|
||||
}
|
||||
SqlOption::KeyValue { key: name, value } => {
|
||||
write!(f, "{} = {}", name, value)
|
||||
write!(f, "{name} = {value}")
|
||||
}
|
||||
SqlOption::Partition {
|
||||
column_name,
|
||||
|
@ -7905,7 +7903,7 @@ impl fmt::Display for SqlOption {
|
|||
SqlOption::NamedParenthesizedList(value) => {
|
||||
write!(f, "{} = ", value.key)?;
|
||||
if let Some(key) = &value.name {
|
||||
write!(f, "{}", key)?;
|
||||
write!(f, "{key}")?;
|
||||
}
|
||||
if !value.values.is_empty() {
|
||||
write!(f, "({})", display_comma_separated(&value.values))?
|
||||
|
@ -7962,7 +7960,7 @@ impl fmt::Display for AttachDuckDBDatabaseOption {
|
|||
AttachDuckDBDatabaseOption::ReadOnly(Some(true)) => write!(f, "READ_ONLY true"),
|
||||
AttachDuckDBDatabaseOption::ReadOnly(Some(false)) => write!(f, "READ_ONLY false"),
|
||||
AttachDuckDBDatabaseOption::ReadOnly(None) => write!(f, "READ_ONLY"),
|
||||
AttachDuckDBDatabaseOption::Type(t) => write!(f, "TYPE {}", t),
|
||||
AttachDuckDBDatabaseOption::Type(t) => write!(f, "TYPE {t}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9485,10 +9483,10 @@ impl fmt::Display for ShowStatementIn {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.clause)?;
|
||||
if let Some(parent_type) = &self.parent_type {
|
||||
write!(f, " {}", parent_type)?;
|
||||
write!(f, " {parent_type}")?;
|
||||
}
|
||||
if let Some(parent_name) = &self.parent_name {
|
||||
write!(f, " {}", parent_name)?;
|
||||
write!(f, " {parent_name}")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -9569,7 +9567,7 @@ impl fmt::Display for TableObject {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
Self::TableName(table_name) => write!(f, "{table_name}"),
|
||||
Self::TableFunction(func) => write!(f, "FUNCTION {}", func),
|
||||
Self::TableFunction(func) => write!(f, "FUNCTION {func}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9757,7 +9755,7 @@ pub struct ReturnStatement {
|
|||
impl fmt::Display for ReturnStatement {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match &self.value {
|
||||
Some(ReturnStatementValue::Expr(expr)) => write!(f, "RETURN {}", expr),
|
||||
Some(ReturnStatementValue::Expr(expr)) => write!(f, "RETURN {expr}"),
|
||||
None => write!(f, "RETURN"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue