Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lovasoa committed Aug 16, 2024
1 parent bbefc33 commit 4d27f85
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
docker-compose -f tests/docker-compose.yml run -d -p 5432:5432 --name postgres_16 postgres_16
docker compose -f tests/docker-compose.yml run -d -p 5432:5432 --name postgres_16 postgres_16
DATABASE_URL="postgres://postgres@localhost:5432/sqlx?sslmode=verify-ca&sslrootcert=./tests/certs/ca.crt&sslcert=./tests/certs/client.crt&sslkey=./tests/keys/client.key" cargo test --features any,postgres,macros,all-types,runtime-actix-rustls --

docker-compose -f tests/docker-compose.yml run -d -p 1433:1433 --name mssql_2022 mssql_2022
docker compose -f tests/docker-compose.yml run -d -p 1433:1433 --name mssql_2022 mssql_2022
DATABASE_URL='mssql://sa:Password123!@localhost/sqlx' cargo test --features any,mssql,macros,all-types,runtime-actix-rustls --
4 changes: 2 additions & 2 deletions tests/postgres/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ async fn query_by_string() -> anyhow::Result<()> {
let mut conn = new::<Postgres>().await?;

let string = "Hello, world!".to_string();
let ref tuple = ("Hello, world!".to_string(),);
let tuple = &("Hello, world!".to_string(),);

let result = sqlx_oldapi::query!(
"SELECT * from (VALUES('Hello, world!')) strings(string)\
Expand Down Expand Up @@ -284,7 +284,7 @@ async fn query_by_bigdecimal() -> anyhow::Result<()> {
// this tests querying by a non-`Copy` type that doesn't have special reborrow semantics

let decimal = "1234".parse::<BigDecimal>()?;
let ref tuple = ("51245.121232".parse::<BigDecimal>()?,);
let tuple = &("51245.121232".parse::<BigDecimal>()?,);

let result = sqlx_oldapi::query!(
"SELECT * from (VALUES(1234.0)) decimals(decimal)\
Expand Down
8 changes: 3 additions & 5 deletions tests/postgres/postgres.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use futures::{StreamExt, TryStreamExt};
use sqlx_core::postgres::PgArguments;
use sqlx_oldapi::postgres::types::Oid;
use sqlx_oldapi::postgres::{
PgAdvisoryLock, PgConnectOptions, PgConnection, PgDatabaseError, PgErrorPosition, PgListener,
Expand All @@ -10,7 +9,6 @@ use sqlx_test::{new, pool, setup_if_needed};
use std::env;
use std::sync::Arc;
use std::time::Duration;
use tokio::time::error::Elapsed;

#[sqlx_macros::test]
async fn it_connects() -> anyhow::Result<()> {
Expand Down Expand Up @@ -1540,12 +1538,12 @@ async fn it_encodes_custom_array_issue_1504() -> anyhow::Result<()> {
Ok(Self::Number(n))
} else if typ == PgTypeInfo::with_name("_text") {
let arr = Vec::<String>::decode(value)?;
let v = arr.into_iter().map(|s| Value::String(s)).collect();
let v = arr.into_iter().map(Value::String).collect();

Ok(Self::Array(v))
} else if typ == PgTypeInfo::with_name("_int4") {
let arr = Vec::<i32>::decode(value)?;
let v = arr.into_iter().map(|n| Value::Number(n)).collect();
let v = arr.into_iter().map(Value::Number).collect();

Ok(Self::Array(v))
} else {
Expand All @@ -1558,7 +1556,7 @@ async fn it_encodes_custom_array_issue_1504() -> anyhow::Result<()> {
fn produces(&self) -> Option<PgTypeInfo> {
match self {
Self::Array(a) => {
if a.len() < 1 {
if a.is_empty() {
return Some(PgTypeInfo::with_name("_text"));
}

Expand Down

0 comments on commit 4d27f85

Please sign in to comment.