{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/2062","repository_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt","labels_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/2062/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/2062/comments","events_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/2062/events","html_url":"https://github.com/rust-lang-nursery/rustfmt/issues/2062","id":265695387,"number":2062,"title":"struct patterns eagerly split across lines in the default configuration","user":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars0.githubusercontent.com/u/155238?v=4","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-16T09:03:39Z","updated_at":"2017-10-17T06:50:35Z","closed_at":null,"author_association":"NONE","body":"Unless struct patterns contain only shorthand variables, they seem to almost always split across multiple lines -- I find this a bit over-eager. For example:\r\n\r\n```rust\r\nfn foo() {\r\n    let Answer { subst, ambiguous: _ } = some_struct;\r\n}\r\n```\r\n\r\nformats to:\r\n\r\n```rust\r\nfn foo() {\r\n    let Answer {\r\n        subst,\r\n        ambiguous: _,\r\n    } = some_struct;\r\n}\r\n```\r\n\r\nwhich seems unnecessary. I tend to use a lot of struct unpacking like that as a way to ensure that if new fields are added I will get compliation errors. Spreading things across multiple lines here makes my code quite spread out vertically.\r\n\r\nSorry if I'm duplicating things! I did a brief search over the issues and didn't find an obvious duplicate.\r\n\r\nVersion: 0.2.8-nightly ( )\r\nConfiguration: None"},"comment":{"url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/comments/337134991","html_url":"https://github.com/rust-lang-nursery/rustfmt/issues/2062#issuecomment-337134991","issue_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/2062","id":337134991,"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":"2017-10-17T06:50:35Z","updated_at":"2017-10-17T06:50:35Z","author_association":"MEMBER","body":"Whether to put struct/variant literals and patterns in a single line is controlled by `struct_lit_width` and `struct_variant_width`. Their default values are `18` and `35`. You could set higher values to allow longer patterns to stay on the same line. We probably should make the default larger, and that is likely to be discussed in #1974."}}
{"actor":{"display_login":"topecongiro"}}