mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-08 01:15:00 +00:00
Fix clippy lint on rust 1.86 (#1796)
This commit is contained in:
parent
7efa686d78
commit
a847e44105
5 changed files with 21 additions and 23 deletions
|
@ -868,7 +868,7 @@ impl fmt::Display for AlterColumnOperation {
|
||||||
AlterColumnOperation::SetDefault { value } => {
|
AlterColumnOperation::SetDefault { value } => {
|
||||||
write!(f, "SET DEFAULT {value}")
|
write!(f, "SET DEFAULT {value}")
|
||||||
}
|
}
|
||||||
AlterColumnOperation::DropDefault {} => {
|
AlterColumnOperation::DropDefault => {
|
||||||
write!(f, "DROP DEFAULT")
|
write!(f, "DROP DEFAULT")
|
||||||
}
|
}
|
||||||
AlterColumnOperation::SetDataType { data_type, using } => {
|
AlterColumnOperation::SetDataType { data_type, using } => {
|
||||||
|
|
|
@ -662,17 +662,17 @@ pub enum Expr {
|
||||||
/// such as maps, arrays, and lists:
|
/// such as maps, arrays, and lists:
|
||||||
/// - Array
|
/// - Array
|
||||||
/// - A 1-dim array `a[1]` will be represented like:
|
/// - A 1-dim array `a[1]` will be represented like:
|
||||||
/// `CompoundFieldAccess(Ident('a'), vec![Subscript(1)]`
|
/// `CompoundFieldAccess(Ident('a'), vec![Subscript(1)]`
|
||||||
/// - A 2-dim array `a[1][2]` will be represented like:
|
/// - A 2-dim array `a[1][2]` will be represented like:
|
||||||
/// `CompoundFieldAccess(Ident('a'), vec![Subscript(1), Subscript(2)]`
|
/// `CompoundFieldAccess(Ident('a'), vec![Subscript(1), Subscript(2)]`
|
||||||
/// - Map or Struct (Bracket-style)
|
/// - Map or Struct (Bracket-style)
|
||||||
/// - A map `a['field1']` will be represented like:
|
/// - A map `a['field1']` will be represented like:
|
||||||
/// `CompoundFieldAccess(Ident('a'), vec![Subscript('field')]`
|
/// `CompoundFieldAccess(Ident('a'), vec![Subscript('field')]`
|
||||||
/// - A 2-dim map `a['field1']['field2']` will be represented like:
|
/// - A 2-dim map `a['field1']['field2']` will be represented like:
|
||||||
/// `CompoundFieldAccess(Ident('a'), vec![Subscript('field1'), Subscript('field2')]`
|
/// `CompoundFieldAccess(Ident('a'), vec![Subscript('field1'), Subscript('field2')]`
|
||||||
/// - Struct (Dot-style) (only effect when the chain contains both subscript and expr)
|
/// - Struct (Dot-style) (only effect when the chain contains both subscript and expr)
|
||||||
/// - A struct access `a[field1].field2` will be represented like:
|
/// - A struct access `a[field1].field2` will be represented like:
|
||||||
/// `CompoundFieldAccess(Ident('a'), vec![Subscript('field1'), Ident('field2')]`
|
/// `CompoundFieldAccess(Ident('a'), vec![Subscript('field1'), Ident('field2')]`
|
||||||
/// - If a struct access likes `a.field1.field2`, it will be represented by CompoundIdentifier([a, field1, field2])
|
/// - If a struct access likes `a.field1.field2`, it will be represented by CompoundIdentifier([a, field1, field2])
|
||||||
CompoundFieldAccess {
|
CompoundFieldAccess {
|
||||||
root: Box<Expr>,
|
root: Box<Expr>,
|
||||||
|
@ -7617,7 +7617,7 @@ impl fmt::Display for CopyTarget {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
use CopyTarget::*;
|
use CopyTarget::*;
|
||||||
match self {
|
match self {
|
||||||
Stdin { .. } => write!(f, "STDIN"),
|
Stdin => write!(f, "STDIN"),
|
||||||
Stdout => write!(f, "STDOUT"),
|
Stdout => write!(f, "STDOUT"),
|
||||||
File { filename } => write!(f, "'{}'", value::escape_single_quote_string(filename)),
|
File { filename } => write!(f, "'{}'", value::escape_single_quote_string(filename)),
|
||||||
Program { command } => write!(
|
Program { command } => write!(
|
||||||
|
|
|
@ -1038,14 +1038,13 @@ fn parse_session_options(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
options
|
if options.is_empty() {
|
||||||
.is_empty()
|
Err(ParserError::ParserError(
|
||||||
.then(|| {
|
"expected at least one option".to_string(),
|
||||||
Err(ParserError::ParserError(
|
))
|
||||||
"expected at least one option".to_string(),
|
} else {
|
||||||
))
|
Ok(options)
|
||||||
})
|
}
|
||||||
.unwrap_or(Ok(options))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parses options provided within parentheses like:
|
/// Parses options provided within parentheses like:
|
||||||
|
|
|
@ -18,14 +18,14 @@
|
||||||
//! This module defines
|
//! This module defines
|
||||||
//! 1) a list of constants for every keyword
|
//! 1) a list of constants for every keyword
|
||||||
//! 2) an `ALL_KEYWORDS` array with every keyword in it
|
//! 2) an `ALL_KEYWORDS` array with every keyword in it
|
||||||
//! This is not a list of *reserved* keywords: some of these can be
|
//! This is not a list of *reserved* keywords: some of these can be
|
||||||
//! parsed as identifiers if the parser decides so. This means that
|
//! parsed as identifiers if the parser decides so. This means that
|
||||||
//! new keywords can be added here without affecting the parse result.
|
//! new keywords can be added here without affecting the parse result.
|
||||||
//!
|
//!
|
||||||
//! As a matter of fact, most of these keywords are not used at all
|
//! As a matter of fact, most of these keywords are not used at all
|
||||||
//! and could be removed.
|
//! and could be removed.
|
||||||
//! 3) a `RESERVED_FOR_TABLE_ALIAS` array with keywords reserved in a
|
//! 3) a `RESERVED_FOR_TABLE_ALIAS` array with keywords reserved in a
|
||||||
//! "table alias" context.
|
//! "table alias" context.
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
@ -14091,8 +14091,7 @@ fn test_table_sample() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn overflow() {
|
fn overflow() {
|
||||||
let expr = std::iter::repeat("1")
|
let expr = std::iter::repeat_n("1", 1000)
|
||||||
.take(1000)
|
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(" + ");
|
.join(" + ");
|
||||||
let sql = format!("SELECT {}", expr);
|
let sql = format!("SELECT {}", expr);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue