{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/2816","repository_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt","labels_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/2816/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/2816/comments","events_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/2816/events","html_url":"https://github.com/rust-lang-nursery/rustfmt/pull/2816","id":336886301,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4MjMxNjY5","number":2816,"title":"Add option to vertically align enum discriminants.","user":{"login":"moxian","id":7831163,"node_id":"MDQ6VXNlcjc4MzExNjM=","avatar_url":"https://avatars2.githubusercontent.com/u/7831163?v=4","gravatar_id":"","url":"https://api.github.com/users/moxian","html_url":"https://github.com/moxian","followers_url":"https://api.github.com/users/moxian/followers","following_url":"https://api.github.com/users/moxian/following{/other_user}","gists_url":"https://api.github.com/users/moxian/gists{/gist_id}","starred_url":"https://api.github.com/users/moxian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moxian/subscriptions","organizations_url":"https://api.github.com/users/moxian/orgs","repos_url":"https://api.github.com/users/moxian/repos","events_url":"https://api.github.com/users/moxian/events{/privacy}","received_events_url":"https://api.github.com/users/moxian/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-29T07:03:16Z","updated_at":"2018-06-30T03:58:42Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/pulls/2816","html_url":"https://github.com/rust-lang-nursery/rustfmt/pull/2816","diff_url":"https://github.com/rust-lang-nursery/rustfmt/pull/2816.diff","patch_url":"https://github.com/rust-lang-nursery/rustfmt/pull/2816.patch"},"body":"Add `enum_discrim_align_threshold` config option, which works similarly to the `struct_field_align_threshold` one.\r\nIf the enum identifiers can be padded with no more than `enum_discrim_align_threshold` spaces to ensure vertical alignment of the discriminants - do so.\r\n\r\nAs an example (from #1686):\r\n\r\n```rust\r\npub enum ColorimetricIntentImageState {\r\n    SceneColorimetryEstimates = 0x73636F65,\r\n    SceneAppearanceEstimates = 0x73617065,\r\n    FocalPlaneColorimetryEstimates = 0x66706365,\r\n    ReflectionHardcopyOriginalColorimetry = 0x72686F63,\r\n    ReflectionPrintOutputColorimetry = 0x72706F63,\r\n}\r\n```\r\nnow becomes\r\n```rust\r\npub enum ColorimetricIntentImageState {\r\n    SceneColorimetryEstimates             = 0x73636F65,\r\n    SceneAppearanceEstimates              = 0x73617065,\r\n    FocalPlaneColorimetryEstimates        = 0x66706365,\r\n    ReflectionHardcopyOriginalColorimetry = 0x72686F63,\r\n    ReflectionPrintOutputColorimetry      = 0x72706F63,\r\n}\r\n```\r\n(but note the different alignment of `=` from the one suggest in that issue. cc @kornelski in case they feel strongly about this)\r\n\r\nFixes #1686\r\nIs part of the larger vertical-alignment project at #1103"},"comment":{"url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/comments/401515263","html_url":"https://github.com/rust-lang-nursery/rustfmt/pull/2816#issuecomment-401515263","issue_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/2816","id":401515263,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTUxNTI2Mw==","user":{"login":"moxian","id":7831163,"node_id":"MDQ6VXNlcjc4MzExNjM=","avatar_url":"https://avatars2.githubusercontent.com/u/7831163?v=4","gravatar_id":"","url":"https://api.github.com/users/moxian","html_url":"https://github.com/moxian","followers_url":"https://api.github.com/users/moxian/followers","following_url":"https://api.github.com/users/moxian/following{/other_user}","gists_url":"https://api.github.com/users/moxian/gists{/gist_id}","starred_url":"https://api.github.com/users/moxian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moxian/subscriptions","organizations_url":"https://api.github.com/users/moxian/orgs","repos_url":"https://api.github.com/users/moxian/repos","events_url":"https://api.github.com/users/moxian/events{/privacy}","received_events_url":"https://api.github.com/users/moxian/received_events","type":"User","site_admin":false},"created_at":"2018-06-30T03:58:42Z","updated_at":"2018-06-30T03:58:42Z","author_association":"NONE","body":"I've given this a bit more thought (and read https://www.joelonsoftware.com/2000/04/12/choices/), and I now think that there should only be a single `vertical_align_threshold` option and not per item type (`struct_field_align_threshold`, `enum_discrim_align_threshold`, `match_arm_align_threshold` etc).\r\n\r\nI'm not sure if it's appropriate to unify those (and, necessarily, rename existing `struct_field_align_threshold`) in this particular PR (I don't think it is), but just leaving this out there in case option name bikeshedding comes to be."}}
{"actor":{"display_login":"moxian"}}