{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang-nursery/fmt-rfcs/issues/39","repository_url":"https://api.github.com/repos/rust-lang-nursery/fmt-rfcs","labels_url":"https://api.github.com/repos/rust-lang-nursery/fmt-rfcs/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang-nursery/fmt-rfcs/issues/39/comments","events_url":"https://api.github.com/repos/rust-lang-nursery/fmt-rfcs/issues/39/events","html_url":"https://github.com/rust-lang-nursery/fmt-rfcs/issues/39","id":189263329,"number":39,"title":"Function definitions","user":{"login":"joshtriplett","id":162737,"avatar_url":"https://avatars.githubusercontent.com/u/162737?v=3","gravatar_id":"","url":"https://api.github.com/users/joshtriplett","html_url":"https://github.com/joshtriplett","followers_url":"https://api.github.com/users/joshtriplett/followers","following_url":"https://api.github.com/users/joshtriplett/following{/other_user}","gists_url":"https://api.github.com/users/joshtriplett/gists{/gist_id}","starred_url":"https://api.github.com/users/joshtriplett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshtriplett/subscriptions","organizations_url":"https://api.github.com/users/joshtriplett/orgs","repos_url":"https://api.github.com/users/joshtriplett/repos","events_url":"https://api.github.com/users/joshtriplett/events{/privacy}","received_events_url":"https://api.github.com/users/joshtriplett/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":33,"created_at":"2016-11-15T00:13:33Z","updated_at":"2016-11-22T09:38:04Z","closed_at":null,"body":"Part of #25: how should we format and indent function definitions?  This includes arguments and their types, generics and their constraints, and the braces; the body of the function then falls under #11.  This also interacts with where clauses (#38), which we may want to fold in."},"comment":{"url":"https://api.github.com/repos/rust-lang-nursery/fmt-rfcs/issues/comments/262192062","html_url":"https://github.com/rust-lang-nursery/fmt-rfcs/issues/39#issuecomment-262192062","issue_url":"https://api.github.com/repos/rust-lang-nursery/fmt-rfcs/issues/39","id":262192062,"user":{"login":"regexident","id":138017,"avatar_url":"https://avatars.githubusercontent.com/u/138017?v=3","gravatar_id":"","url":"https://api.github.com/users/regexident","html_url":"https://github.com/regexident","followers_url":"https://api.github.com/users/regexident/followers","following_url":"https://api.github.com/users/regexident/following{/other_user}","gists_url":"https://api.github.com/users/regexident/gists{/gist_id}","starred_url":"https://api.github.com/users/regexident/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/regexident/subscriptions","organizations_url":"https://api.github.com/users/regexident/orgs","repos_url":"https://api.github.com/users/regexident/repos","events_url":"https://api.github.com/users/regexident/events{/privacy}","received_events_url":"https://api.github.com/users/regexident/received_events","type":"User","site_admin":false},"created_at":"2016-11-22T09:38:04Z","updated_at":"2016-11-22T09:38:04Z","body":"> (3) Never put a `where`-clause on the same line with `fn`. If it's such a short and easy where-clause, just specify it inline in the generic parameter list.\r\n>\r\n> (4) If it's not, use a separate line for the where-clause.\r\n\r\nI have come to prefer trait bounds to always be found in a separate `where` clause regardless of the number/length of bounds.\r\n\r\nI don't want to have to look at multiple potential syntax positions for a single semantic thing/concept. Alternating declaration positions introduce ambiguities when visually scanning code.\r\n\r\nImagine having to search for a `fn`'s parameters both within the parentheses …\r\n\r\n```rust\r\nfn function_name(foo: T, bar: U) -> Return {\r\n    body;\r\n}\r\n```\r\n\r\n… as well as at the end of its signature …\r\n\r\n```rust\r\nfn function_name() -> Return\r\n    where (foo: T, bar: U, baz: V)\r\n{\r\n    body;\r\n}\r\n```\r\n\r\n… depending on whether the signature fits into a single line.\r\n\r\nWe don't allow this for function parameters, and imho shouldn't allow (or at least not encourage) this for bounds either.\r\n\r\nEven worse, having bounds at both positions:\r\n```rust\r\nfn function_name<T: Clone>(param: T) -> Return\r\n    where T: LongTraitName + AnotherVerboseTraitName\r\n{\r\n    body;\r\n}\r\n```\r\n\r\nThe latter I'd actually consider a code smell that rustc/clippy should be warning about."}}
{"actor":{"display_login":"regexident"}}