From c7fd8ec01cd529046743f79d067000dc475d5438 Mon Sep 17 00:00:00 2001 From: kyoto7250 <50972773+kyoto7250@users.noreply.github.com> Date: Thu, 2 Nov 2023 22:53:28 +0900 Subject: [PATCH 1/2] update bigdecimal 0.4.1 -> 0.4.2 --- .github/workflows/diesel.yml | 4 ++-- examples/diesel_postgres/Readme.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/diesel.yml b/.github/workflows/diesel.yml index 63631ff3c..c153baa74 100644 --- a/.github/workflows/diesel.yml +++ b/.github/workflows/diesel.yml @@ -44,7 +44,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@stable - - run: cargo update --manifest-path sea-query-diesel/Cargo.toml --workspace -p bigdecimal:0.4.1 --precise 0.3.1 + - run: cargo update --manifest-path sea-query-diesel/Cargo.toml --workspace -p bigdecimal:0.4.2 --precise 0.3.1 - run: cargo build --manifest-path sea-query-diesel/Cargo.toml --workspace --features postgres,sqlite,mysql --features=with-chrono,with-json,with-rust_decimal,with-bigdecimal,with-uuid,with-time,with-ipnetwork,with-mac_address,postgres-array - run: cargo build --manifest-path sea-query-diesel/Cargo.toml --workspace --features postgres,sqlite,mysql --features=with-chrono - run: cargo build --manifest-path sea-query-diesel/Cargo.toml --workspace --features postgres,sqlite,mysql --features=with-json @@ -157,6 +157,6 @@ jobs: steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@stable - - run: cargo update --manifest-path examples/${{ matrix.example }}/Cargo.toml -p bigdecimal:0.4.1 --precise 0.3.1 + - run: cargo update --manifest-path examples/${{ matrix.example }}/Cargo.toml -p bigdecimal:0.4.2 --precise 0.3.1 - run: cargo build --manifest-path examples/${{ matrix.example }}/Cargo.toml - run: cargo run --manifest-path examples/${{ matrix.example }}/Cargo.toml diff --git a/examples/diesel_postgres/Readme.md b/examples/diesel_postgres/Readme.md index 937085f35..595fd5a78 100644 --- a/examples/diesel_postgres/Readme.md +++ b/examples/diesel_postgres/Readme.md @@ -1,7 +1,7 @@ # SeaQuery Diesel Postgres example > WARN: If you enable `with-bigdecimal`, you HAVE to update the version used by default by `diesel` -> otherwise it will fail to build. Use `cargo update -p bigdecimal:0.4.1 --precise 0.3.1`. +> otherwise it will fail to build. Use `cargo update -p bigdecimal:0.4.2 --precise 0.3.1`. Running: From 32334b0e63ad1590cbe8a108cc682f507e3bf78d Mon Sep 17 00:00:00 2001 From: kyoto7250 <50972773+kyoto7250@users.noreply.github.com> Date: Thu, 2 Nov 2023 23:04:43 +0900 Subject: [PATCH 2/2] fix warnings that clippy told https://rust-lang.github.io/rust-clippy/master/index.html#/format_collect --- src/backend/postgres/query.rs | 5 ++++- src/backend/query_builder.rs | 5 ++++- src/query/with.rs | 3 +-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/backend/postgres/query.rs b/src/backend/postgres/query.rs index 2970f4442..7b5c66e9b 100644 --- a/src/backend/postgres/query.rs +++ b/src/backend/postgres/query.rs @@ -159,7 +159,10 @@ impl QueryBuilder for PostgresQueryBuilder { write!( buffer, "'\\x{}'", - bytes.iter().map(|b| format!("{b:02X}")).collect::() + bytes.iter().fold(String::new(), |mut output, b| { + let _ = write!(output, "{b:02X}"); + output + }) ) .unwrap() } diff --git a/src/backend/query_builder.rs b/src/backend/query_builder.rs index fd8c7677d..04e7c3b85 100644 --- a/src/backend/query_builder.rs +++ b/src/backend/query_builder.rs @@ -1408,7 +1408,10 @@ pub trait QueryBuilder: write!( buffer, "x'{}'", - bytes.iter().map(|b| format!("{b:02X}")).collect::() + bytes.iter().fold(String::new(), |mut output, b| { + let _ = write!(output, "{b:02X}"); + output + }) ) .unwrap() } diff --git a/src/query/with.rs b/src/query/with.rs index 4b1e4d3fc..89ea69164 100644 --- a/src/query/with.rs +++ b/src/query/with.rs @@ -10,7 +10,6 @@ use crate::SqlWriter; use crate::SubQueryStatement; use crate::TableRef; use crate::{Alias, QueryBuilder}; -use std::ops::Deref; /// A table definition inside a WITH clause ([WithClause]). /// @@ -122,7 +121,7 @@ impl CommonTableExpression { let mut cte = Self::default(); cte.try_set_cols_from_selects(&select.selects); if let Some(from) = select.from.get(0) { - match from.deref() { + match from { TableRef::Table(iden) => cte.set_table_name_from_select(iden), TableRef::SchemaTable(_, iden) => cte.set_table_name_from_select(iden), TableRef::DatabaseSchemaTable(_, _, iden) => cte.set_table_name_from_select(iden),