Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary nesting from generated impls #479

Merged
merged 2 commits into from
Aug 4, 2016
Merged

Remove unnecessary nesting from generated impls #479

merged 2 commits into from
Aug 4, 2016

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Aug 4, 2016

We were using ast::Expr surrounded by { } in a few places that should have been ast::Block. This PR decreases the indentation to make the generated code easier to read when it needs to be debugged.

@dtolnay dtolnay changed the title Remove unnecessary nesting from generated Serialize implementations Remove unnecessary nesting from generated impls Aug 4, 2016
@oli-obk
Copy link
Member

oli-obk commented Aug 4, 2016

I was surprised this works for function bodies... But the retokenization erases all info... I guess that's ok

@oli-obk oli-obk merged commit 1c55f58 into master Aug 4, 2016
@dtolnay dtolnay deleted the nestser branch August 4, 2016 07:09
@dtolnay
Copy link
Member Author

dtolnay commented Aug 4, 2016

It works but not with a comma after the where clause, for some reason.

// does not work
fn deserialize<__D>(deserializer: &mut __D) -> ::std::result::Result<$ty, __D::Error>
    where __D: _serde::de::Deserializer,
$body

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants