Skip to content

Commit 76cf629

Browse files
committed
fix: use correct field in ColumnDecode
1 parent 2c8938f commit 76cf629

File tree

1 file changed

+9
-3
lines changed
  • sqlx-macros-core/src/derives

1 file changed

+9
-3
lines changed

sqlx-macros-core/src/derives/row.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,11 @@ fn expand_derive_from_row_struct(
119119
.and_then(|v| {
120120
<#ty as ::std::convert::TryFrom::<#try_from>>::try_from(v)
121121
.map_err(|e| {
122+
// Triggers a lint warning if `TryFrom::Err = Infallible`
123+
#[allow(unreachable_code)]
122124
::sqlx::Error::ColumnDecode {
123125
index: #id_s.to_string(),
124-
error: sqlx::__spec_error!(e),
126+
source: sqlx::__spec_error!(e),
125127
}
126128
})
127129
})
@@ -142,9 +144,11 @@ fn expand_derive_from_row_struct(
142144
.and_then(|v| {
143145
<#ty as ::std::convert::TryFrom::<#try_from>>::try_from(v)
144146
.map_err(|e| {
147+
// Triggers a lint warning if `TryFrom::Err = Infallible`
148+
#[allow(unreachable_code)]
145149
::sqlx::Error::ColumnDecode {
146150
index: #id_s.to_string(),
147-
error: sqlx::__spec_error!(e),
151+
source: sqlx::__spec_error!(e),
148152
}
149153
})
150154
})
@@ -161,9 +165,11 @@ fn expand_derive_from_row_struct(
161165
.and_then(|v| {
162166
<#ty as ::std::convert::TryFrom::<#try_from>>::try_from(v.0)
163167
.map_err(|e| {
168+
// Triggers a lint warning if `TryFrom::Err = Infallible`
169+
#[allow(unreachable_code)]
164170
::sqlx::Error::ColumnDecode {
165171
index: #id_s.to_string(),
166-
error: sqlx::__spec_error!(e),
172+
source: sqlx::__spec_error!(e),
167173
}
168174
})
169175
})

0 commit comments

Comments
 (0)