Skip to content

Commit 4d27f85

Browse files
committed
clippy fixes
1 parent bbefc33 commit 4d27f85

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
2-
docker-compose -f tests/docker-compose.yml run -d -p 5432:5432 --name postgres_16 postgres_16
2+
docker compose -f tests/docker-compose.yml run -d -p 5432:5432 --name postgres_16 postgres_16
33
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 --
44

5-
docker-compose -f tests/docker-compose.yml run -d -p 1433:1433 --name mssql_2022 mssql_2022
5+
docker compose -f tests/docker-compose.yml run -d -p 1433:1433 --name mssql_2022 mssql_2022
66
DATABASE_URL='mssql://sa:Password123!@localhost/sqlx' cargo test --features any,mssql,macros,all-types,runtime-actix-rustls --

tests/postgres/macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ async fn query_by_string() -> anyhow::Result<()> {
254254
let mut conn = new::<Postgres>().await?;
255255

256256
let string = "Hello, world!".to_string();
257-
let ref tuple = ("Hello, world!".to_string(),);
257+
let tuple = &("Hello, world!".to_string(),);
258258

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

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

289289
let result = sqlx_oldapi::query!(
290290
"SELECT * from (VALUES(1234.0)) decimals(decimal)\

tests/postgres/postgres.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use futures::{StreamExt, TryStreamExt};
2-
use sqlx_core::postgres::PgArguments;
32
use sqlx_oldapi::postgres::types::Oid;
43
use sqlx_oldapi::postgres::{
54
PgAdvisoryLock, PgConnectOptions, PgConnection, PgDatabaseError, PgErrorPosition, PgListener,
@@ -10,7 +9,6 @@ use sqlx_test::{new, pool, setup_if_needed};
109
use std::env;
1110
use std::sync::Arc;
1211
use std::time::Duration;
13-
use tokio::time::error::Elapsed;
1412

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

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

15501548
Ok(Self::Array(v))
15511549
} else {
@@ -1558,7 +1556,7 @@ async fn it_encodes_custom_array_issue_1504() -> anyhow::Result<()> {
15581556
fn produces(&self) -> Option<PgTypeInfo> {
15591557
match self {
15601558
Self::Array(a) => {
1561-
if a.len() < 1 {
1559+
if a.is_empty() {
15621560
return Some(PgTypeInfo::with_name("_text"));
15631561
}
15641562

0 commit comments

Comments
 (0)