Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
abonander committed Jul 26, 2024
1 parent df1e72b commit 292f082
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/sqlx-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
- uses: Swatinem/rust-cache@v2

- run: cargo clippy --manifest_path sqlx-cli/Cargo.toml -- -D warnings
- run: cargo clippy --manifest-path sqlx-cli/Cargo.toml -- -D warnings

# Run beta for new warnings but don't break the build.
# Use a subdirectory of `target` to avoid clobbering the cache.
- run: >
cargo +beta clippy
--manifest_path sqlx-cli/Cargo.toml
--manifest-path sqlx-cli/Cargo.toml
--target-dir target/beta/
test:
Expand Down
1 change: 1 addition & 0 deletions sqlx-core/src/any/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub use connection::AnyConnection;
use crate::encode::Encode;
pub use connection::AnyConnectionBackend;
pub use database::Any;
#[allow(deprecated)]
pub use kind::AnyKind;
pub use options::AnyConnectOptions;
pub use query_result::AnyQueryResult;
Expand Down
2 changes: 1 addition & 1 deletion sqlx-core/src/pool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ impl<DB: Database> Pool<DB> {
/// // This is because `.do_until()` cancels the future it's given if the
/// // pool is closed first.
/// println!("Waited!");
///
///
/// Ok(())
/// }).await
/// });
Expand Down
23 changes: 8 additions & 15 deletions tests/postgres/query_builder.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use sqlx::Execute;
use sqlx::postgres::Postgres;
use sqlx::query_builder::QueryBuilder;
use sqlx::Execute;

#[test]
fn test_new() {
Expand All @@ -15,25 +15,24 @@ fn test_push() {
qb.push(second_line);

assert_eq!(
qb.sql(),
"SELECT * FROM users WHERE last_name LIKE '[A-N]%';".to_string(),
);
qb.sql(),
"SELECT * FROM users WHERE last_name LIKE '[A-N]%';".to_string(),
);
}

#[test]
#[should_panic]
fn test_push_panics_after_build_without_reset() {
let mut qb: QueryBuilder<'_, Postgres> = QueryBuilder::new("SELECT * FROM users;");

let _query = qb.build();

qb.push("SELECT * FROM users;");
}

#[test]
fn test_push_bind() {
let mut qb: QueryBuilder<'_, Postgres> =
QueryBuilder::new("SELECT * FROM users WHERE id = ");
let mut qb: QueryBuilder<'_, Postgres> = QueryBuilder::new("SELECT * FROM users WHERE id = ");

qb.push_bind(42i32)
.push(" OR membership_level = ")
Expand All @@ -52,10 +51,7 @@ fn test_build() {
qb.push(" WHERE id = ").push_bind(42i32);
let query = qb.build();

assert_eq!(
query.sql(),
"SELECT * FROM users WHERE id = $1"
);
assert_eq!(query.sql(), "SELECT * FROM users WHERE id = $1");
assert_eq!(Execute::persistent(&query), true);
}

Expand Down Expand Up @@ -86,10 +82,7 @@ fn test_query_builder_reuse() {

let query = qb.push("SELECT * FROM users WHERE id = 99").build();

assert_eq!(
query.sql(),
"SELECT * FROM users WHERE id = 99"
);
assert_eq!(query.sql(), "SELECT * FROM users WHERE id = 99");
}

#[test]
Expand Down

0 comments on commit 292f082

Please sign in to comment.