Skip to content

Commit a1ac87a

Browse files
committed
Fix clippy lints on 1.88.0
1 parent 95d16e3 commit a1ac87a

24 files changed

+221
-227
lines changed

examples/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ $ cargo run --example cli - [--dialectname]
6363
};
6464

6565
let contents = if filename == "-" {
66-
println!("Parsing from stdin using {:?}", dialect);
66+
println!("Parsing from stdin using {dialect:?}");
6767
let mut buf = Vec::new();
6868
stdin()
6969
.read_to_end(&mut buf)

sqlparser_bench/benches/sqlparser_bench.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,24 @@ fn basic_queries(c: &mut Criterion) {
4545

4646
let large_statement = {
4747
let expressions = (0..1000)
48-
.map(|n| format!("FN_{}(COL_{})", n, n))
48+
.map(|n| format!("FN_{n}(COL_{n})"))
4949
.collect::<Vec<_>>()
5050
.join(", ");
5151
let tables = (0..1000)
52-
.map(|n| format!("TABLE_{}", n))
52+
.map(|n| format!("TABLE_{n}"))
5353
.collect::<Vec<_>>()
5454
.join(" JOIN ");
5555
let where_condition = (0..1000)
56-
.map(|n| format!("COL_{} = {}", n, n))
56+
.map(|n| format!("COL_{n} = {n}"))
5757
.collect::<Vec<_>>()
5858
.join(" OR ");
5959
let order_condition = (0..1000)
60-
.map(|n| format!("COL_{} DESC", n))
60+
.map(|n| format!("COL_{n} DESC"))
6161
.collect::<Vec<_>>()
6262
.join(", ");
6363

6464
format!(
65-
"SELECT {} FROM {} WHERE {} ORDER BY {}",
66-
expressions, tables, where_condition, order_condition
65+
"SELECT {expressions} FROM {tables} WHERE {where_condition} ORDER BY {order_condition}"
6766
)
6867
};
6968

src/ast/data_type.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ impl fmt::Display for DataType {
666666
}
667667
DataType::Enum(vals, bits) => {
668668
match bits {
669-
Some(bits) => write!(f, "ENUM{}", bits),
669+
Some(bits) => write!(f, "ENUM{bits}"),
670670
None => write!(f, "ENUM"),
671671
}?;
672672
write!(f, "(")?;
@@ -714,16 +714,16 @@ impl fmt::Display for DataType {
714714
}
715715
// ClickHouse
716716
DataType::Nullable(data_type) => {
717-
write!(f, "Nullable({})", data_type)
717+
write!(f, "Nullable({data_type})")
718718
}
719719
DataType::FixedString(character_length) => {
720-
write!(f, "FixedString({})", character_length)
720+
write!(f, "FixedString({character_length})")
721721
}
722722
DataType::LowCardinality(data_type) => {
723-
write!(f, "LowCardinality({})", data_type)
723+
write!(f, "LowCardinality({data_type})")
724724
}
725725
DataType::Map(key_data_type, value_data_type) => {
726-
write!(f, "Map({}, {})", key_data_type, value_data_type)
726+
write!(f, "Map({key_data_type}, {value_data_type})")
727727
}
728728
DataType::Tuple(fields) => {
729729
write!(f, "Tuple({})", display_comma_separated(fields))
@@ -745,7 +745,7 @@ impl fmt::Display for DataType {
745745
DataType::NamedTable { name, columns } => {
746746
write!(f, "{} TABLE ({})", name, display_comma_separated(columns))
747747
}
748-
DataType::GeometricType(kind) => write!(f, "{}", kind),
748+
DataType::GeometricType(kind) => write!(f, "{kind}"),
749749
DataType::TsVector => write!(f, "TSVECTOR"),
750750
DataType::TsQuery => write!(f, "TSQUERY"),
751751
}
@@ -942,7 +942,7 @@ impl fmt::Display for CharacterLength {
942942
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
943943
match self {
944944
CharacterLength::IntegerLength { length, unit } => {
945-
write!(f, "{}", length)?;
945+
write!(f, "{length}")?;
946946
if let Some(unit) = unit {
947947
write!(f, " {unit}")?;
948948
}
@@ -997,7 +997,7 @@ impl fmt::Display for BinaryLength {
997997
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
998998
match self {
999999
BinaryLength::IntegerLength { length } => {
1000-
write!(f, "{}", length)?;
1000+
write!(f, "{length}")?;
10011001
}
10021002
BinaryLength::Max => {
10031003
write!(f, "MAX")?;

src/ast/dcl.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl fmt::Display for AlterRoleOperation {
173173
in_database,
174174
} => {
175175
if let Some(database_name) = in_database {
176-
write!(f, "IN DATABASE {} ", database_name)?;
176+
write!(f, "IN DATABASE {database_name} ")?;
177177
}
178178

179179
match config_value {
@@ -187,7 +187,7 @@ impl fmt::Display for AlterRoleOperation {
187187
in_database,
188188
} => {
189189
if let Some(database_name) = in_database {
190-
write!(f, "IN DATABASE {} ", database_name)?;
190+
write!(f, "IN DATABASE {database_name} ")?;
191191
}
192192

193193
match config_name {
@@ -218,15 +218,15 @@ impl fmt::Display for Use {
218218
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
219219
f.write_str("USE ")?;
220220
match self {
221-
Use::Catalog(name) => write!(f, "CATALOG {}", name),
222-
Use::Schema(name) => write!(f, "SCHEMA {}", name),
223-
Use::Database(name) => write!(f, "DATABASE {}", name),
224-
Use::Warehouse(name) => write!(f, "WAREHOUSE {}", name),
225-
Use::Role(name) => write!(f, "ROLE {}", name),
221+
Use::Catalog(name) => write!(f, "CATALOG {name}"),
222+
Use::Schema(name) => write!(f, "SCHEMA {name}"),
223+
Use::Database(name) => write!(f, "DATABASE {name}"),
224+
Use::Warehouse(name) => write!(f, "WAREHOUSE {name}"),
225+
Use::Role(name) => write!(f, "ROLE {name}"),
226226
Use::SecondaryRoles(secondary_roles) => {
227-
write!(f, "SECONDARY ROLES {}", secondary_roles)
227+
write!(f, "SECONDARY ROLES {secondary_roles}")
228228
}
229-
Use::Object(name) => write!(f, "{}", name),
229+
Use::Object(name) => write!(f, "{name}"),
230230
Use::Default => write!(f, "DEFAULT"),
231231
}
232232
}

src/ast/ddl.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl fmt::Display for ReplicaIdentity {
5757
ReplicaIdentity::None => f.write_str("NONE"),
5858
ReplicaIdentity::Full => f.write_str("FULL"),
5959
ReplicaIdentity::Default => f.write_str("DEFAULT"),
60-
ReplicaIdentity::Index(idx) => write!(f, "USING INDEX {}", idx),
60+
ReplicaIdentity::Index(idx) => write!(f, "USING INDEX {idx}"),
6161
}
6262
}
6363
}
@@ -450,7 +450,7 @@ pub enum Owner {
450450
impl fmt::Display for Owner {
451451
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
452452
match self {
453-
Owner::Ident(ident) => write!(f, "{}", ident),
453+
Owner::Ident(ident) => write!(f, "{ident}"),
454454
Owner::CurrentRole => write!(f, "CURRENT_ROLE"),
455455
Owner::CurrentUser => write!(f, "CURRENT_USER"),
456456
Owner::SessionUser => write!(f, "SESSION_USER"),
@@ -525,7 +525,7 @@ impl fmt::Display for AlterTableOperation {
525525
if *if_not_exists {
526526
write!(f, " IF NOT EXISTS")?;
527527
}
528-
write!(f, " {} ({})", name, query)
528+
write!(f, " {name} ({query})")
529529
}
530530
AlterTableOperation::Algorithm { equals, algorithm } => {
531531
write!(
@@ -540,7 +540,7 @@ impl fmt::Display for AlterTableOperation {
540540
if *if_exists {
541541
write!(f, " IF EXISTS")?;
542542
}
543-
write!(f, " {}", name)
543+
write!(f, " {name}")
544544
}
545545
AlterTableOperation::MaterializeProjection {
546546
if_exists,
@@ -551,9 +551,9 @@ impl fmt::Display for AlterTableOperation {
551551
if *if_exists {
552552
write!(f, " IF EXISTS")?;
553553
}
554-
write!(f, " {}", name)?;
554+
write!(f, " {name}")?;
555555
if let Some(partition) = partition {
556-
write!(f, " IN PARTITION {}", partition)?;
556+
write!(f, " IN PARTITION {partition}")?;
557557
}
558558
Ok(())
559559
}
@@ -566,9 +566,9 @@ impl fmt::Display for AlterTableOperation {
566566
if *if_exists {
567567
write!(f, " IF EXISTS")?;
568568
}
569-
write!(f, " {}", name)?;
569+
write!(f, " {name}")?;
570570
if let Some(partition) = partition {
571-
write!(f, " IN PARTITION {}", partition)?;
571+
write!(f, " IN PARTITION {partition}")?;
572572
}
573573
Ok(())
574574
}
@@ -1168,7 +1168,7 @@ impl fmt::Display for TableConstraint {
11681168
write!(f, " ON UPDATE {action}")?;
11691169
}
11701170
if let Some(characteristics) = characteristics {
1171-
write!(f, " {}", characteristics)?;
1171+
write!(f, " {characteristics}")?;
11721172
}
11731173
Ok(())
11741174
}
@@ -1308,7 +1308,7 @@ impl fmt::Display for IndexType {
13081308
Self::SPGiST => write!(f, "SPGIST"),
13091309
Self::BRIN => write!(f, "BRIN"),
13101310
Self::Bloom => write!(f, "BLOOM"),
1311-
Self::Custom(name) => write!(f, "{}", name),
1311+
Self::Custom(name) => write!(f, "{name}"),
13121312
}
13131313
}
13141314
}
@@ -1450,7 +1450,7 @@ impl fmt::Display for ViewColumnDef {
14501450
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
14511451
write!(f, "{}", self.name)?;
14521452
if let Some(data_type) = self.data_type.as_ref() {
1453-
write!(f, " {}", data_type)?;
1453+
write!(f, " {data_type}")?;
14541454
}
14551455
if let Some(options) = self.options.as_ref() {
14561456
match options {
@@ -1845,7 +1845,7 @@ impl fmt::Display for ColumnOption {
18451845
} => {
18461846
write!(f, "{}", if *is_primary { "PRIMARY KEY" } else { "UNIQUE" })?;
18471847
if let Some(characteristics) = characteristics {
1848-
write!(f, " {}", characteristics)?;
1848+
write!(f, " {characteristics}")?;
18491849
}
18501850
Ok(())
18511851
}
@@ -1867,7 +1867,7 @@ impl fmt::Display for ColumnOption {
18671867
write!(f, " ON UPDATE {action}")?;
18681868
}
18691869
if let Some(characteristics) = characteristics {
1870-
write!(f, " {}", characteristics)?;
1870+
write!(f, " {characteristics}")?;
18711871
}
18721872
Ok(())
18731873
}
@@ -1927,7 +1927,7 @@ impl fmt::Display for ColumnOption {
19271927
write!(f, "{parameters}")
19281928
}
19291929
OnConflict(keyword) => {
1930-
write!(f, "ON CONFLICT {:?}", keyword)?;
1930+
write!(f, "ON CONFLICT {keyword:?}")?;
19311931
Ok(())
19321932
}
19331933
Policy(parameters) => {

src/ast/dml.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl Display for IndexColumn {
5555
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
5656
write!(f, "{}", self.column)?;
5757
if let Some(operator_class) = &self.operator_class {
58-
write!(f, " {}", operator_class)?;
58+
write!(f, " {operator_class}")?;
5959
}
6060
Ok(())
6161
}
@@ -266,7 +266,7 @@ impl Display for CreateTable {
266266
name = self.name,
267267
)?;
268268
if let Some(on_cluster) = &self.on_cluster {
269-
write!(f, " ON CLUSTER {}", on_cluster)?;
269+
write!(f, " ON CLUSTER {on_cluster}")?;
270270
}
271271
if !self.columns.is_empty() || !self.constraints.is_empty() {
272272
f.write_str(" (")?;
@@ -383,15 +383,15 @@ impl Display for CreateTable {
383383
match &self.table_options {
384384
options @ CreateTableOptions::With(_)
385385
| options @ CreateTableOptions::Plain(_)
386-
| options @ CreateTableOptions::TableProperties(_) => write!(f, " {}", options)?,
386+
| options @ CreateTableOptions::TableProperties(_) => write!(f, " {options}")?,
387387
_ => (),
388388
}
389389

390390
if let Some(primary_key) = &self.primary_key {
391-
write!(f, " PRIMARY KEY {}", primary_key)?;
391+
write!(f, " PRIMARY KEY {primary_key}")?;
392392
}
393393
if let Some(order_by) = &self.order_by {
394-
write!(f, " ORDER BY {}", order_by)?;
394+
write!(f, " ORDER BY {order_by}")?;
395395
}
396396
if let Some(inherits) = &self.inherits {
397397
write!(f, " INHERITS ({})", display_comma_separated(inherits))?;
@@ -403,7 +403,7 @@ impl Display for CreateTable {
403403
write!(f, " CLUSTER BY {cluster_by}")?;
404404
}
405405
if let options @ CreateTableOptions::Options(_) = &self.table_options {
406-
write!(f, " {}", options)?;
406+
write!(f, " {options}")?;
407407
}
408408
if let Some(external_volume) = self.external_volume.as_ref() {
409409
write!(f, " EXTERNAL_VOLUME = '{external_volume}'")?;

src/ast/helpers/key_value_options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl fmt::Display for KeyValueOptions {
6767
} else {
6868
f.write_str(" ")?;
6969
}
70-
write!(f, "{}", option)?;
70+
write!(f, "{option}")?;
7171
}
7272
}
7373
Ok(())

0 commit comments

Comments
 (0)