Skip to content

Commit

Permalink
Remove double nesting of first_attempt
Browse files Browse the repository at this point in the history
`expr` is of type serde_derive::fragment::Expr, which can be
interpolated directly in any expression position. It does not
need to be nested in another set of braces.
  • Loading branch information
dtolnay committed Oct 13, 2023
1 parent 2a7c7fa commit b908487
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions serde_derive/src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1754,18 +1754,18 @@ fn deserialize_untagged_enum_after(
// need to provide the error type.
let first_attempt = first_attempt.map(|expr| {
quote! {
if let _serde::__private::Result::<_, __D::Error>::Ok(__ok) = (|| {
#expr
})() {
if let _serde::__private::Result::<_, __D::Error>::Ok(__ok) = (|| #expr)() {
return _serde::__private::Ok(__ok);
}
}
});

quote_block! {
let __content = <_serde::__private::de::Content as _serde::Deserialize>::deserialize(__deserializer)?;
let __deserializer = _serde::__private::de::ContentRefDeserializer::<__D::Error>::new(&__content);

#first_attempt

#(
if let _serde::__private::Ok(__ok) = #attempts {
return _serde::__private::Ok(__ok);
Expand Down

0 comments on commit b908487

Please sign in to comment.