Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the CI: update bigdecimal and fix warnings #718

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/diesel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion examples/diesel_postgres/Readme.md
Original file line number Diff line number Diff line change
@@ -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:

Expand Down
5 changes: 4 additions & 1 deletion src/backend/postgres/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ impl QueryBuilder for PostgresQueryBuilder {
write!(
buffer,
"'\\x{}'",
bytes.iter().map(|b| format!("{b:02X}")).collect::<String>()
bytes.iter().fold(String::new(), |mut output, b| {
let _ = write!(output, "{b:02X}");
output
})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)
.unwrap()
}
Expand Down
5 changes: 4 additions & 1 deletion src/backend/query_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,10 @@ pub trait QueryBuilder:
write!(
buffer,
"x'{}'",
bytes.iter().map(|b| format!("{b:02X}")).collect::<String>()
bytes.iter().fold(String::new(), |mut output, b| {
let _ = write!(output, "{b:02X}");
output
})
)
.unwrap()
}
Expand Down
3 changes: 1 addition & 2 deletions src/query/with.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]).
///
Expand Down Expand Up @@ -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),
Expand Down