{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/2549","repository_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt","labels_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/2549/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/2549/comments","events_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/2549/events","html_url":"https://github.com/rust-lang-nursery/rustfmt/pull/2549","id":307291830,"number":2549,"title":"Add config option to control spaces around colon in macro def","user":{"login":"topecongiro","id":21980157,"avatar_url":"https://avatars2.githubusercontent.com/u/21980157?v=4","gravatar_id":"","url":"https://api.github.com/users/topecongiro","html_url":"https://github.com/topecongiro","followers_url":"https://api.github.com/users/topecongiro/followers","following_url":"https://api.github.com/users/topecongiro/following{/other_user}","gists_url":"https://api.github.com/users/topecongiro/gists{/gist_id}","starred_url":"https://api.github.com/users/topecongiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/topecongiro/subscriptions","organizations_url":"https://api.github.com/users/topecongiro/orgs","repos_url":"https://api.github.com/users/topecongiro/repos","events_url":"https://api.github.com/users/topecongiro/events{/privacy}","received_events_url":"https://api.github.com/users/topecongiro/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-03-21T15:22:48Z","updated_at":"2018-03-23T11:46:24Z","closed_at":"2018-03-22T21:51:48Z","author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/pulls/2549","html_url":"https://github.com/rust-lang-nursery/rustfmt/pull/2549","diff_url":"https://github.com/rust-lang-nursery/rustfmt/pull/2549.diff","patch_url":"https://github.com/rust-lang-nursery/rustfmt/pull/2549.patch"},"body":"This PR adds two config options `space_after_colon_macro_def` and `space_before_colon_macro_def` which control spaces around a colon of metavariable definitions in macro def.\r\n\r\nAlso this PR changes the default format to **not** to put a space after a colon. I think that the formatting without a space is more popular in the wild, and incurs less conflicts with users.\r\n\r\nAlternatively we could decide whether we should add a space or not based on what kind of separator is used in the definition: if arguments are separated by `,`, then we add a space after each colon, but if weird separators, like `=>`, `:` or even just a space, are used, then we do not add a space. However this seems too complex and error-prone, so I would rather keep the rule simple and consistent.\r\n\r\n@nrc Do you have any thoughts on this?\r\n\r\n--- \r\n\r\nDo we need two options? I think that we do not need to add `space_before_colon_macro_def`, I just added it for consistency with other options."},"comment":{"url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/comments/375634071","html_url":"https://github.com/rust-lang-nursery/rustfmt/pull/2549#issuecomment-375634071","issue_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/2549","id":375634071,"user":{"login":"topecongiro","id":21980157,"avatar_url":"https://avatars2.githubusercontent.com/u/21980157?v=4","gravatar_id":"","url":"https://api.github.com/users/topecongiro","html_url":"https://github.com/topecongiro","followers_url":"https://api.github.com/users/topecongiro/followers","following_url":"https://api.github.com/users/topecongiro/following{/other_user}","gists_url":"https://api.github.com/users/topecongiro/gists{/gist_id}","starred_url":"https://api.github.com/users/topecongiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/topecongiro/subscriptions","organizations_url":"https://api.github.com/users/topecongiro/orgs","repos_url":"https://api.github.com/users/topecongiro/repos","events_url":"https://api.github.com/users/topecongiro/events{/privacy}","received_events_url":"https://api.github.com/users/topecongiro/received_events","type":"User","site_admin":false},"created_at":"2018-03-23T11:46:24Z","updated_at":"2018-03-23T11:46:24Z","author_association":"MEMBER","body":"Also we need to get rid of `unreachable!()`s in macro.rs. I initially thought that macro def like `macro foo ($x:) {}` will be a parse error, but apparently it is not, and rustfmt will reach an unreacahble code."}}
{"actor":{"display_login":"topecongiro"}}