Skip to content

Commit 27e8062

Browse files
committed
refactor(postgres): fix tests
This commit refactors the error handling in PgRecordDecoder by removing the redundant use of the MismatchedTypeError, streamlining the return of mismatched type errors. The changes enhance code clarity and maintainability in type decoding scenarios.
1 parent 1498620 commit 27e8062

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

sqlx-core/src/postgres/types/record.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use bytes::Buf;
22

33
use crate::decode::Decode;
44
use crate::encode::Encode;
5-
use crate::error::{mismatched_types, BoxDynError};
5+
use crate::error::BoxDynError;
66
use crate::postgres::type_info::{PgType, PgTypeKind};
77
use crate::postgres::types::Oid;
88
use crate::postgres::{PgArgumentBuffer, PgTypeInfo, PgValueFormat, PgValueRef, Postgres};
@@ -127,9 +127,7 @@ impl<'r> PgRecordDecoder<'r> {
127127

128128
if let Some(ty) = &element_type_opt {
129129
if !ty.is_null() && !T::compatible(ty) {
130-
return Err(crate::error::Error::MismatchedType(
131-
crate::error::mismatched_types::<Postgres, T>(ty),
132-
));
130+
return Err(crate::error::mismatched_types::<Postgres, T>(ty));
133131
}
134132
}
135133

0 commit comments

Comments
 (0)