{"action":"created","issue":{"url":"https://api.github.com/repos/nrc/rustfmt/issues/347","labels_url":"https://api.github.com/repos/nrc/rustfmt/issues/347/labels{/name}","comments_url":"https://api.github.com/repos/nrc/rustfmt/issues/347/comments","events_url":"https://api.github.com/repos/nrc/rustfmt/issues/347/events","html_url":"https://github.com/nrc/rustfmt/pull/347","id":107660119,"number":347,"title":"match arms collapse for issue #339","user":{"login":"scyptnex","id":674155,"avatar_url":"https://avatars.githubusercontent.com/u/674155?v=3","gravatar_id":"","url":"https://api.github.com/users/scyptnex","html_url":"https://github.com/scyptnex","followers_url":"https://api.github.com/users/scyptnex/followers","following_url":"https://api.github.com/users/scyptnex/following{/other_user}","gists_url":"https://api.github.com/users/scyptnex/gists{/gist_id}","starred_url":"https://api.github.com/users/scyptnex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scyptnex/subscriptions","organizations_url":"https://api.github.com/users/scyptnex/orgs","repos_url":"https://api.github.com/users/scyptnex/repos","events_url":"https://api.github.com/users/scyptnex/events{/privacy}","received_events_url":"https://api.github.com/users/scyptnex/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-09-22T07:31:56Z","updated_at":"2015-09-23T05:06:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nrc/rustfmt/pulls/347","html_url":"https://github.com/nrc/rustfmt/pull/347","diff_url":"https://github.com/nrc/rustfmt/pull/347.diff","patch_url":"https://github.com/nrc/rustfmt/pull/347.patch"},"body":"Few things\r\n - we had a test case that violated this anyway, changed that case assuming this is the desired behaviour\r\n - functionalised nop-block-collapsing because `if`,`fn`, `struct`, `loop` etc. might want the same treatment\r\n - this code only executes for match arms, the above constructs could use same idea, but currently dont, implementing it for all (i.e. in Block.rewrite) causes many test-cases to fail.\r\n\r\nOutstanding:\r\n - vertical whitespace issues.  Awaiting what to do about vertical whitespace,\r\ncant format:\r\n```\r\na => {\r\n\r\n    //some comment\r\n\r\n\r\n}\r\n```\r\nto\r\n```\r\na => {\r\n    //some comment\r\n}\r\n```\r\nas expected, without some policy on vertical whitespace, which will be global, not just match arms"},"comment":{"url":"https://api.github.com/repos/nrc/rustfmt/issues/comments/142492100","html_url":"https://github.com/nrc/rustfmt/pull/347#issuecomment-142492100","issue_url":"https://api.github.com/repos/nrc/rustfmt/issues/347","id":142492100,"user":{"login":"nrc","id":762626,"avatar_url":"https://avatars.githubusercontent.com/u/762626?v=3","gravatar_id":"","url":"https://api.github.com/users/nrc","html_url":"https://github.com/nrc","followers_url":"https://api.github.com/users/nrc/followers","following_url":"https://api.github.com/users/nrc/following{/other_user}","gists_url":"https://api.github.com/users/nrc/gists{/gist_id}","starred_url":"https://api.github.com/users/nrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nrc/subscriptions","organizations_url":"https://api.github.com/users/nrc/orgs","repos_url":"https://api.github.com/users/nrc/repos","events_url":"https://api.github.com/users/nrc/events{/privacy}","received_events_url":"https://api.github.com/users/nrc/received_events","type":"User","site_admin":false},"created_at":"2015-09-23T05:06:24Z","updated_at":"2015-09-23T05:06:24Z","body":"Comments have basically been a sore spot for rustfmt for a while. There is no good way to handle all comments since they are not represented in the AST at all. Since the work with the HIR landed, I think there is potential to fix this in the compiler, but I don't know of any plans to.\r\n\r\nSo, our current handling of comments is totally ad hoc. We try to handle them well wherever they are likely to occur and don't worry to much about perfection. I feel like formatting\r\n\r\n```\r\na => {\r\n}//trailing comment\r\n```\r\nto\r\n```\r\na => {} //trailing comment\r\n```\r\n\r\nshouldn't be difficult, but I haven't looked at the new code yet."}}