-
Notifications
You must be signed in to change notification settings - Fork 896
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
Try shorthand #893
Try shorthand #893
Conversation
@@ -148,6 +148,7 @@ impl Rewrite for ast::Expr { | |||
ast::ExprKind::Closure(capture, ref fn_decl, ref body) => { | |||
rewrite_closure(capture, fn_decl, body, self.span, context, width, offset) | |||
} | |||
// ast::ExprKind::Try(..) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this meant to be commented out?
let yyyy = expr?.another?.another?.another?.another?.another?.another?.another?.another?.test(); | ||
let zzzz = expr?.another?.another?.another?.another?; | ||
let aaa = x??????????????????????????????????????????????????????????????????????????; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
output looks ok to me!
looks good to me. I think the output looks good. Re the FIXME, I think we should never separate the |
I was trying this and got a panic when using it as the last expression in a block, e.g.: fn test() {
a?
}
(where line 127 is the last line in the example) |
Thanks for the test case @erikjohnston, I'll see if I can fix it! |
Turned out to be a rustc bug. This PR will have to wait until rust-lang/rust#32711 lands and syntax_syntex is updated. |
The Rust PR (finally) landed. Shouldn't be too long until a syntex update. |
Updated. we now also convert uses of Tests won't pass yet -- still need syntex update. |
@marcusklaas hey, are the changes in syntex now? Would be great to land this, I'd like to release 0.5 soon, and it would be great for this to be part of it (need it for formatting stuff in the Rust repo, amongst other things). |
I just made #971 to bump to syntex 0.31. Not sure if it includes the change but just in case. :-) |
I don't think it does - but the next version should.. Just a bit longer! |
@marcusklaas have a syntex_syntax bump: #979 :-) |
Thanks for the syntex update @kamalmarhubi. I'll see if I can rebase this :-) |
Yo @nrc, this should be ready to merge now. I've also implemented a break in assignments when it's more compact. It should mitigate the need for tab indentation in chains; I'll look into that a bit more. |
Closes #985. |
Supersedes #751 too. |
Addresses #574 as well. |
ast::ExprKind::Try(_) => (), | ||
_ => result.push_str(connector), | ||
}; | ||
result.push_str(&rewrite[..]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: probably don't need the [..]
This is based off #892.
Addresses #867. I'm not 100% content with the implementation, but would like to get some feedback on the output before refining it.
r? @kamalmarhubi, @nrc?