{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/743","labels_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/743/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/743/comments","events_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/743/events","html_url":"https://github.com/rust-lang-nursery/rustfmt/issues/743","id":124836112,"number":743,"title":"Comments swallowed in multi-line arithmetic expression","user":{"login":"ericsink","id":3877005,"avatar_url":"https://avatars.githubusercontent.com/u/3877005?v=3","gravatar_id":"","url":"https://api.github.com/users/ericsink","html_url":"https://github.com/ericsink","followers_url":"https://api.github.com/users/ericsink/followers","following_url":"https://api.github.com/users/ericsink/following{/other_user}","gists_url":"https://api.github.com/users/ericsink/gists{/gist_id}","starred_url":"https://api.github.com/users/ericsink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericsink/subscriptions","organizations_url":"https://api.github.com/users/ericsink/orgs","repos_url":"https://api.github.com/users/ericsink/repos","events_url":"https://api.github.com/users/ericsink/events{/privacy}","received_events_url":"https://api.github.com/users/ericsink/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/labels/comments","name":"comments","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-04T20:48:23Z","updated_at":"2016-01-04T20:58:41Z","closed_at":null,"body":"When formatting this code:\r\n\r\n    fn calc_page_len(prefix_len: usize, sofar: usize) -> usize {\r\n        2 // page type and flags\r\n        + 1 // stored depth\r\n        + 2 // stored count\r\n        + varint::space_needed_for(prefix_len as u64) \r\n        + prefix_len \r\n        + sofar // sum of size of all the actual items\r\n    }\r\n\r\nI get:\r\n\r\n    fn calc_page_len(prefix_len: usize, sofar: usize) -> usize {\r\n        2 + 1 + 2 + varint::space_needed_for(prefix_len as u64) + prefix_len + sofar // sum of size of all the actual items\r\n    }\r\n\r\nWhich means some of the comments got eaten.\r\n\r\nI recognize that if I want a multi-line arithmetic expression like this then I'll probably need to add an attribute to prevent rustfmt from touching it, but it still seems kinda wrong to reformat it and lose comments."},"comment":{"url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/comments/168806926","html_url":"https://github.com/rust-lang-nursery/rustfmt/issues/743#issuecomment-168806926","issue_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/743","id":168806926,"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":"2016-01-04T20:58:41Z","updated_at":"2016-01-04T20:58:41Z","body":"Yeah, this is a limitation of the approach and the current Rust AST, we just don't see those comments. One day we'll fix this via a change to the Rust compiler."}}