Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0744636

Browse files
committedApr 14, 2025·
fix: lots, *lots* more Clippy warnings
1 parent 1ea5b72 commit 0744636

File tree

15 files changed

+58
-65
lines changed

15 files changed

+58
-65
lines changed
 

‎examples/postgres/listen/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ from (
9898
) notifies(chan, payload)
9999
"#,
100100
)
101-
.bind(&COUNTER.fetch_add(1, Ordering::SeqCst))
102-
.bind(&COUNTER.fetch_add(1, Ordering::SeqCst))
103-
.bind(&COUNTER.fetch_add(1, Ordering::SeqCst))
101+
.bind(COUNTER.fetch_add(1, Ordering::SeqCst))
102+
.bind(COUNTER.fetch_add(1, Ordering::SeqCst))
103+
.bind(COUNTER.fetch_add(1, Ordering::SeqCst))
104104
.execute(pool)
105105
.await;
106106

‎sqlx-core/src/net/tls/tls_rustls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ where
138138
}
139139
} else {
140140
#[cfg(any(feature = "_tls-rustls-aws-lc-rs", feature = "_tls-rustls-ring-webpki"))]
141-
let cert_store = certs_from_webpki();
141+
let mut cert_store = certs_from_webpki();
142142
#[cfg(feature = "_tls-rustls-ring-native-roots")]
143143
let mut cert_store = certs_from_native_store();
144144

‎sqlx-core/src/pool/inner.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,13 +451,15 @@ pub(super) fn is_beyond_max_lifetime<DB: Database>(
451451
options: &PoolOptions<DB>,
452452
) -> bool {
453453
options
454-
.max_lifetime.is_some_and(|max| live.created_at.elapsed() > max)
454+
.max_lifetime
455+
.is_some_and(|max| live.created_at.elapsed() > max)
455456
}
456457

457458
/// Returns `true` if the connection has exceeded `options.idle_timeout` if set, `false` otherwise.
458459
fn is_beyond_idle_timeout<DB: Database>(idle: &Idle<DB>, options: &PoolOptions<DB>) -> bool {
459460
options
460-
.idle_timeout.is_some_and(|timeout| idle.idle_since.elapsed() > timeout)
461+
.idle_timeout
462+
.is_some_and(|timeout| idle.idle_since.elapsed() > timeout)
461463
}
462464

463465
async fn check_idle_conn<DB: Database>(

‎sqlx-mysql/src/io/buf_mut.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,71 +45,71 @@ impl MySqlBufMutExt for Vec<u8> {
4545
#[test]
4646
fn test_encodes_int_lenenc_u8() {
4747
let mut buf = Vec::with_capacity(1024);
48-
buf.put_uint_lenenc(0xFA as u64);
48+
buf.put_uint_lenenc(0xFA_u64);
4949

5050
assert_eq!(&buf[..], b"\xFA");
5151
}
5252

5353
#[test]
5454
fn test_encodes_int_lenenc_u16() {
5555
let mut buf = Vec::with_capacity(1024);
56-
buf.put_uint_lenenc(std::u16::MAX as u64);
56+
buf.put_uint_lenenc(u16::MAX as u64);
5757

5858
assert_eq!(&buf[..], b"\xFC\xFF\xFF");
5959
}
6060

6161
#[test]
6262
fn test_encodes_int_lenenc_u24() {
6363
let mut buf = Vec::with_capacity(1024);
64-
buf.put_uint_lenenc(0xFF_FF_FF as u64);
64+
buf.put_uint_lenenc(0xFF_FF_FF_u64);
6565

6666
assert_eq!(&buf[..], b"\xFD\xFF\xFF\xFF");
6767
}
6868

6969
#[test]
7070
fn test_encodes_int_lenenc_u64() {
7171
let mut buf = Vec::with_capacity(1024);
72-
buf.put_uint_lenenc(std::u64::MAX);
72+
buf.put_uint_lenenc(u64::MAX);
7373

7474
assert_eq!(&buf[..], b"\xFE\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF");
7575
}
7676

7777
#[test]
7878
fn test_encodes_int_lenenc_fb() {
7979
let mut buf = Vec::with_capacity(1024);
80-
buf.put_uint_lenenc(0xFB as u64);
80+
buf.put_uint_lenenc(0xFB_u64);
8181

8282
assert_eq!(&buf[..], b"\xFC\xFB\x00");
8383
}
8484

8585
#[test]
8686
fn test_encodes_int_lenenc_fc() {
8787
let mut buf = Vec::with_capacity(1024);
88-
buf.put_uint_lenenc(0xFC as u64);
88+
buf.put_uint_lenenc(0xFC_u64);
8989

9090
assert_eq!(&buf[..], b"\xFC\xFC\x00");
9191
}
9292

9393
#[test]
9494
fn test_encodes_int_lenenc_fd() {
9595
let mut buf = Vec::with_capacity(1024);
96-
buf.put_uint_lenenc(0xFD as u64);
96+
buf.put_uint_lenenc(0xFD_u64);
9797

9898
assert_eq!(&buf[..], b"\xFC\xFD\x00");
9999
}
100100

101101
#[test]
102102
fn test_encodes_int_lenenc_fe() {
103103
let mut buf = Vec::with_capacity(1024);
104-
buf.put_uint_lenenc(0xFE as u64);
104+
buf.put_uint_lenenc(0xFE_u64);
105105

106106
assert_eq!(&buf[..], b"\xFC\xFE\x00");
107107
}
108108

109109
#[test]
110110
fn test_encodes_int_lenenc_ff() {
111111
let mut buf = Vec::with_capacity(1024);
112-
buf.put_uint_lenenc(0xFF as u64);
112+
buf.put_uint_lenenc(0xFF_u64);
113113

114114
assert_eq!(&buf[..], b"\xFC\xFF\x00");
115115
}

‎sqlx-postgres/src/advisory_lock.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ impl<'lock, C: AsMut<PgConnection>> PgAdvisoryLockGuard<'lock, C> {
362362
}
363363
}
364364

365-
impl<'lock, C: AsMut<PgConnection> + AsRef<PgConnection>> Deref for PgAdvisoryLockGuard<'lock, C> {
365+
impl<C: AsMut<PgConnection> + AsRef<PgConnection>> Deref for PgAdvisoryLockGuard<'_, C> {
366366
type Target = PgConnection;
367367

368368
fn deref(&self) -> &Self::Target {
@@ -376,16 +376,14 @@ impl<'lock, C: AsMut<PgConnection> + AsRef<PgConnection>> Deref for PgAdvisoryLo
376376
/// However, replacing the connection with a different one using, e.g. [`std::mem::replace()`]
377377
/// is a logic error and will cause a warning to be logged by the PostgreSQL server when this
378378
/// guard attempts to release the lock.
379-
impl<'lock, C: AsMut<PgConnection> + AsRef<PgConnection>> DerefMut
380-
for PgAdvisoryLockGuard<'lock, C>
381-
{
379+
impl<C: AsMut<PgConnection> + AsRef<PgConnection>> DerefMut for PgAdvisoryLockGuard<'_, C> {
382380
fn deref_mut(&mut self) -> &mut Self::Target {
383381
self.conn.as_mut().expect(NONE_ERR).as_mut()
384382
}
385383
}
386384

387-
impl<'lock, C: AsMut<PgConnection> + AsRef<PgConnection>> AsRef<PgConnection>
388-
for PgAdvisoryLockGuard<'lock, C>
385+
impl<C: AsMut<PgConnection> + AsRef<PgConnection>> AsRef<PgConnection>
386+
for PgAdvisoryLockGuard<'_, C>
389387
{
390388
fn as_ref(&self) -> &PgConnection {
391389
self.conn.as_ref().expect(NONE_ERR).as_ref()
@@ -398,7 +396,7 @@ impl<'lock, C: AsMut<PgConnection> + AsRef<PgConnection>> AsRef<PgConnection>
398396
/// However, replacing the connection with a different one using, e.g. [`std::mem::replace()`]
399397
/// is a logic error and will cause a warning to be logged by the PostgreSQL server when this
400398
/// guard attempts to release the lock.
401-
impl<'lock, C: AsMut<PgConnection>> AsMut<PgConnection> for PgAdvisoryLockGuard<'lock, C> {
399+
impl<C: AsMut<PgConnection>> AsMut<PgConnection> for PgAdvisoryLockGuard<'_, C> {
402400
fn as_mut(&mut self) -> &mut PgConnection {
403401
self.conn.as_mut().expect(NONE_ERR).as_mut()
404402
}
@@ -407,7 +405,7 @@ impl<'lock, C: AsMut<PgConnection>> AsMut<PgConnection> for PgAdvisoryLockGuard<
407405
/// Queues a `pg_advisory_unlock()` call on the wrapped connection which will be flushed
408406
/// to the server the next time it is used, or when it is returned to [`PgPool`][crate::PgPool]
409407
/// in the case of [`PoolConnection<Postgres>`][crate::pool::PoolConnection].
410-
impl<'lock, C: AsMut<PgConnection>> Drop for PgAdvisoryLockGuard<'lock, C> {
408+
impl<C: AsMut<PgConnection>> Drop for PgAdvisoryLockGuard<'_, C> {
411409
fn drop(&mut self) {
412410
if let Some(mut conn) = self.conn.take() {
413411
// Queue a simple query message to execute next time the connection is used.

‎sqlx-postgres/src/connection/executor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl PgConnection {
159159
self.inner.pending_ready_for_query_count += 1;
160160
}
161161

162-
async fn get_or_prepare<'a>(
162+
async fn get_or_prepare(
163163
&mut self,
164164
sql: &str,
165165
parameters: &[PgTypeInfo],

‎sqlx-postgres/src/connection/tls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{PgConnectOptions, PgSslMode};
77

88
pub struct MaybeUpgradeTls<'a>(pub &'a PgConnectOptions);
99

10-
impl<'a> WithSocket for MaybeUpgradeTls<'a> {
10+
impl WithSocket for MaybeUpgradeTls<'_> {
1111
type Output = crate::Result<Box<dyn Socket>>;
1212

1313
async fn with_socket<S: Socket>(self, socket: S) -> Self::Output {

‎sqlx-postgres/src/listener.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,12 +506,12 @@ fn build_listen_all_query(channels: impl IntoIterator<Item = impl AsRef<str>>) -
506506

507507
#[test]
508508
fn test_build_listen_all_query_with_single_channel() {
509-
let output = build_listen_all_query(&["test"]);
509+
let output = build_listen_all_query(["test"]);
510510
assert_eq!(output.as_str(), r#"LISTEN "test";"#);
511511
}
512512

513513
#[test]
514514
fn test_build_listen_all_query_with_multiple_channels() {
515-
let output = build_listen_all_query(&["channel.0", "channel.1"]);
515+
let output = build_listen_all_query(["channel.0", "channel.1"]);
516516
assert_eq!(output.as_str(), r#"LISTEN "channel.0";LISTEN "channel.1";"#);
517517
}

‎sqlx-postgres/src/message/response.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ struct Fields<'a> {
195195
offset: usize,
196196
}
197197

198-
impl<'a> Iterator for Fields<'a> {
198+
impl Iterator for Fields<'_> {
199199
type Item = (u8, Range<usize>);
200200

201201
fn next(&mut self) -> Option<Self::Item> {

‎sqlx-postgres/src/options/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ fn built_url_can_be_parsed() {
336336
let url = "postgres://username:p@ssw0rd@hostname:5432/database";
337337
let opts = PgConnectOptions::from_str(url).unwrap();
338338

339-
let parsed = PgConnectOptions::from_str(&opts.build_url().to_string());
339+
let parsed = PgConnectOptions::from_str(opts.build_url().as_ref());
340340

341341
assert!(parsed.is_ok());
342342
}

‎sqlx-postgres/src/types/bigdecimal.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ fn sign_to_pg(sign: Sign) -> PgNumericSign {
213213
}
214214

215215
#[cfg(test)]
216-
mod bigdecimal_to_pgnumeric {
216+
#[allow(clippy::zero_prefixed_literal)] // Used for clarity
217+
mod tests {
217218
use super::{BigDecimal, PgNumeric, PgNumericSign};
218219
use std::convert::TryFrom;
219220

‎sqlx-postgres/src/types/interval.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ fn test_encode_interval() {
231231
microseconds: 0,
232232
};
233233
assert!(matches!(
234-
Encode::<Postgres>::encode(&interval, &mut buf),
234+
Encode::<Postgres>::encode(interval, &mut buf),
235235
Ok(IsNull::No)
236236
));
237237
assert_eq!(&**buf, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
@@ -243,7 +243,7 @@ fn test_encode_interval() {
243243
microseconds: 1_000,
244244
};
245245
assert!(matches!(
246-
Encode::<Postgres>::encode(&interval, &mut buf),
246+
Encode::<Postgres>::encode(interval, &mut buf),
247247
Ok(IsNull::No)
248248
));
249249
assert_eq!(&**buf, [0, 0, 0, 0, 0, 0, 3, 232, 0, 0, 0, 0, 0, 0, 0, 0]);
@@ -255,7 +255,7 @@ fn test_encode_interval() {
255255
microseconds: 1_000_000,
256256
};
257257
assert!(matches!(
258-
Encode::<Postgres>::encode(&interval, &mut buf),
258+
Encode::<Postgres>::encode(interval, &mut buf),
259259
Ok(IsNull::No)
260260
));
261261
assert_eq!(&**buf, [0, 0, 0, 0, 0, 15, 66, 64, 0, 0, 0, 0, 0, 0, 0, 0]);
@@ -267,7 +267,7 @@ fn test_encode_interval() {
267267
microseconds: 3_600_000_000,
268268
};
269269
assert!(matches!(
270-
Encode::<Postgres>::encode(&interval, &mut buf),
270+
Encode::<Postgres>::encode(interval, &mut buf),
271271
Ok(IsNull::No)
272272
));
273273
assert_eq!(
@@ -282,7 +282,7 @@ fn test_encode_interval() {
282282
microseconds: 0,
283283
};
284284
assert!(matches!(
285-
Encode::<Postgres>::encode(&interval, &mut buf),
285+
Encode::<Postgres>::encode(interval, &mut buf),
286286
Ok(IsNull::No)
287287
));
288288
assert_eq!(&**buf, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]);
@@ -294,7 +294,7 @@ fn test_encode_interval() {
294294
microseconds: 0,
295295
};
296296
assert!(matches!(
297-
Encode::<Postgres>::encode(&interval, &mut buf),
297+
Encode::<Postgres>::encode(interval, &mut buf),
298298
Ok(IsNull::No)
299299
));
300300
assert_eq!(&**buf, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]);

‎sqlx-postgres/src/types/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl PgHasArrayType for JsonRawValue {
5454
}
5555
}
5656

57-
impl<'q, T> Encode<'q, Postgres> for Json<T>
57+
impl<T> Encode<'_, Postgres> for Json<T>
5858
where
5959
T: Serialize,
6060
{

‎sqlx-postgres/src/types/rust_decimal.rs

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ impl Decode<'_, Postgres> for Decimal {
188188
}
189189

190190
#[cfg(test)]
191+
#[allow(clippy::zero_prefixed_literal)] // Used for clarity
191192
mod tests {
192193
use super::{Decimal, PgNumeric, PgNumericSign};
193194
use std::convert::TryFrom;
@@ -205,7 +206,7 @@ mod tests {
205206
fn one() {
206207
let one: Decimal = "1".parse().unwrap();
207208
assert_eq!(
208-
PgNumeric::try_from(&one).unwrap(),
209+
PgNumeric::from(&one),
209210
PgNumeric::Number {
210211
sign: PgNumericSign::Positive,
211212
scale: 0,
@@ -219,7 +220,7 @@ mod tests {
219220
fn ten() {
220221
let ten: Decimal = "10".parse().unwrap();
221222
assert_eq!(
222-
PgNumeric::try_from(&ten).unwrap(),
223+
PgNumeric::from(&ten),
223224
PgNumeric::Number {
224225
sign: PgNumericSign::Positive,
225226
scale: 0,
@@ -233,7 +234,7 @@ mod tests {
233234
fn one_hundred() {
234235
let one_hundred: Decimal = "100".parse().unwrap();
235236
assert_eq!(
236-
PgNumeric::try_from(&one_hundred).unwrap(),
237+
PgNumeric::from(&one_hundred),
237238
PgNumeric::Number {
238239
sign: PgNumericSign::Positive,
239240
scale: 0,
@@ -248,7 +249,7 @@ mod tests {
248249
// Decimal doesn't normalize here
249250
let ten_thousand: Decimal = "10000".parse().unwrap();
250251
assert_eq!(
251-
PgNumeric::try_from(&ten_thousand).unwrap(),
252+
PgNumeric::from(&ten_thousand),
252253
PgNumeric::Number {
253254
sign: PgNumericSign::Positive,
254255
scale: 0,
@@ -262,7 +263,7 @@ mod tests {
262263
fn two_digits() {
263264
let two_digits: Decimal = "12345".parse().unwrap();
264265
assert_eq!(
265-
PgNumeric::try_from(&two_digits).unwrap(),
266+
PgNumeric::from(&two_digits),
266267
PgNumeric::Number {
267268
sign: PgNumericSign::Positive,
268269
scale: 0,
@@ -276,7 +277,7 @@ mod tests {
276277
fn one_tenth() {
277278
let one_tenth: Decimal = "0.1".parse().unwrap();
278279
assert_eq!(
279-
PgNumeric::try_from(&one_tenth).unwrap(),
280+
PgNumeric::from(&one_tenth),
280281
PgNumeric::Number {
281282
sign: PgNumericSign::Positive,
282283
scale: 1,
@@ -290,7 +291,7 @@ mod tests {
290291
fn decimal_1() {
291292
let decimal: Decimal = "1.2345".parse().unwrap();
292293
assert_eq!(
293-
PgNumeric::try_from(&decimal).unwrap(),
294+
PgNumeric::from(&decimal),
294295
PgNumeric::Number {
295296
sign: PgNumericSign::Positive,
296297
scale: 4,
@@ -304,7 +305,7 @@ mod tests {
304305
fn decimal_2() {
305306
let decimal: Decimal = "0.12345".parse().unwrap();
306307
assert_eq!(
307-
PgNumeric::try_from(&decimal).unwrap(),
308+
PgNumeric::from(&decimal),
308309
PgNumeric::Number {
309310
sign: PgNumericSign::Positive,
310311
scale: 5,
@@ -318,7 +319,7 @@ mod tests {
318319
fn decimal_3() {
319320
let decimal: Decimal = "0.01234".parse().unwrap();
320321
assert_eq!(
321-
PgNumeric::try_from(&decimal).unwrap(),
322+
PgNumeric::from(&decimal),
322323
PgNumeric::Number {
323324
sign: PgNumericSign::Positive,
324325
scale: 5,
@@ -337,7 +338,7 @@ mod tests {
337338
weight: 1,
338339
digits: vec![1, 2345, 6789],
339340
};
340-
assert_eq!(PgNumeric::try_from(&decimal).unwrap(), expected_numeric);
341+
assert_eq!(PgNumeric::from(&decimal), expected_numeric);
341342

342343
let actual_decimal = Decimal::try_from(expected_numeric).unwrap();
343344
assert_eq!(actual_decimal, decimal);
@@ -354,10 +355,7 @@ mod tests {
354355
weight: -2,
355356
digits: vec![1234],
356357
};
357-
assert_eq!(
358-
PgNumeric::try_from(&one_digit_decimal).unwrap(),
359-
expected_numeric
360-
);
358+
assert_eq!(PgNumeric::from(&one_digit_decimal), expected_numeric);
361359

362360
let actual_decimal = Decimal::try_from(expected_numeric).unwrap();
363361
assert_eq!(actual_decimal, one_digit_decimal);
@@ -373,10 +371,7 @@ mod tests {
373371
weight: 7,
374372
digits: vec![7, 9228, 1625, 1426, 4337, 5935, 4395, 0335],
375373
};
376-
assert_eq!(
377-
PgNumeric::try_from(&Decimal::MAX).unwrap(),
378-
expected_numeric
379-
);
374+
assert_eq!(PgNumeric::from(&Decimal::MAX), expected_numeric);
380375

381376
let actual_decimal = Decimal::try_from(expected_numeric).unwrap();
382377
assert_eq!(actual_decimal, Decimal::MAX);
@@ -399,10 +394,7 @@ mod tests {
399394
weight: 0,
400395
digits: vec![7, 9228, 1625, 1426, 4337, 5935, 4395, 0335],
401396
};
402-
assert_eq!(
403-
PgNumeric::try_from(&max_value_max_scale).unwrap(),
404-
expected_numeric
405-
);
397+
assert_eq!(PgNumeric::from(&max_value_max_scale), expected_numeric);
406398

407399
let actual_decimal = Decimal::try_from(expected_numeric).unwrap();
408400
assert_eq!(actual_decimal, max_value_max_scale);
@@ -418,7 +410,7 @@ mod tests {
418410
// This is a regression test for https://github.com/launchbadge/sqlx/issues/423
419411
let four_digit: Decimal = "1234".parse().unwrap();
420412
assert_eq!(
421-
PgNumeric::try_from(&four_digit).unwrap(),
413+
PgNumeric::from(&four_digit),
422414
PgNumeric::Number {
423415
sign: PgNumericSign::Positive,
424416
scale: 0,
@@ -433,7 +425,7 @@ mod tests {
433425
// This is a regression test for https://github.com/launchbadge/sqlx/issues/423
434426
let negative_four_digit: Decimal = "-1234".parse().unwrap();
435427
assert_eq!(
436-
PgNumeric::try_from(&negative_four_digit).unwrap(),
428+
PgNumeric::from(&negative_four_digit),
437429
PgNumeric::Number {
438430
sign: PgNumericSign::Negative,
439431
scale: 0,
@@ -448,7 +440,7 @@ mod tests {
448440
// This is a regression test for https://github.com/launchbadge/sqlx/issues/423
449441
let eight_digit: Decimal = "12345678".parse().unwrap();
450442
assert_eq!(
451-
PgNumeric::try_from(&eight_digit).unwrap(),
443+
PgNumeric::from(&eight_digit),
452444
PgNumeric::Number {
453445
sign: PgNumericSign::Positive,
454446
scale: 0,
@@ -463,7 +455,7 @@ mod tests {
463455
// This is a regression test for https://github.com/launchbadge/sqlx/issues/423
464456
let negative_eight_digit: Decimal = "-12345678".parse().unwrap();
465457
assert_eq!(
466-
PgNumeric::try_from(&negative_eight_digit).unwrap(),
458+
PgNumeric::from(&negative_eight_digit),
467459
PgNumeric::Number {
468460
sign: PgNumericSign::Negative,
469461
scale: 0,
@@ -483,7 +475,7 @@ mod tests {
483475
weight: 0,
484476
digits: vec![100],
485477
};
486-
assert_eq!(PgNumeric::try_from(&one_hundred).unwrap(), expected_numeric);
478+
assert_eq!(PgNumeric::from(&one_hundred), expected_numeric);
487479

488480
let actual_decimal = Decimal::try_from(expected_numeric).unwrap();
489481
assert_eq!(actual_decimal, one_hundred);

‎sqlx-postgres/src/types/text.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl<T> Type<Postgres> for Text<T> {
1818
}
1919
}
2020

21-
impl<'q, T> Encode<'q, Postgres> for Text<T>
21+
impl<T> Encode<'_, Postgres> for Text<T>
2222
where
2323
T: Display,
2424
{

0 commit comments

Comments
 (0)
Please sign in to comment.