{"action":"closed","number":326,"pull_request":{"url":"https://api.github.com/repos/nrc/rustfmt/pulls/326","id":45226211,"html_url":"https://github.com/nrc/rustfmt/pull/326","diff_url":"https://github.com/nrc/rustfmt/pull/326.diff","patch_url":"https://github.com/nrc/rustfmt/pull/326.patch","issue_url":"https://api.github.com/repos/nrc/rustfmt/issues/326","number":326,"state":"closed","locked":false,"title":"Refactor rustfmt's interface and test code","user":{"login":"marcusklaas","id":1255413,"avatar_url":"https://avatars.githubusercontent.com/u/1255413?v=3","gravatar_id":"","url":"https://api.github.com/users/marcusklaas","html_url":"https://github.com/marcusklaas","followers_url":"https://api.github.com/users/marcusklaas/followers","following_url":"https://api.github.com/users/marcusklaas/following{/other_user}","gists_url":"https://api.github.com/users/marcusklaas/gists{/gist_id}","starred_url":"https://api.github.com/users/marcusklaas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcusklaas/subscriptions","organizations_url":"https://api.github.com/users/marcusklaas/orgs","repos_url":"https://api.github.com/users/marcusklaas/repos","events_url":"https://api.github.com/users/marcusklaas/events{/privacy}","received_events_url":"https://api.github.com/users/marcusklaas/received_events","type":"User","site_admin":false},"body":"In this PR, we propose a new public function `format`, which simply returns the result of the reformatting, without any side effects. This should give us more freedom and control than wrapping logic in a callback.\r\n\r\nWe use this extra control to update the test code, which no longer needs to rely on `thread::catch_panic`, and run some extra checks. From now on, when rustfmt's own code exceeds the maximum_width, the tests will no longer pass.\r\n\r\nFixes https://github.com/nrc/rustfmt/issues/183.","created_at":"2015-09-16T21:24:54Z","updated_at":"2015-09-18T20:37:09Z","closed_at":"2015-09-18T20:37:09Z","merged_at":"2015-09-18T20:37:09Z","merge_commit_sha":"817d1881f28773c6104b72b1f4bc18c09133571a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nrc/rustfmt/pulls/326/commits","review_comments_url":"https://api.github.com/repos/nrc/rustfmt/pulls/326/comments","review_comment_url":"https://api.github.com/repos/nrc/rustfmt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nrc/rustfmt/issues/326/comments","statuses_url":"https://api.github.com/repos/nrc/rustfmt/statuses/e72d4882819d8d747746199ade3adcf06292e3a3","head":{"label":"marcusklaas:interface-refactor","ref":"interface-refactor","sha":"e72d4882819d8d747746199ade3adcf06292e3a3","user":{"login":"marcusklaas","id":1255413,"avatar_url":"https://avatars.githubusercontent.com/u/1255413?v=3","gravatar_id":"","url":"https://api.github.com/users/marcusklaas","html_url":"https://github.com/marcusklaas","followers_url":"https://api.github.com/users/marcusklaas/followers","following_url":"https://api.github.com/users/marcusklaas/following{/other_user}","gists_url":"https://api.github.com/users/marcusklaas/gists{/gist_id}","starred_url":"https://api.github.com/users/marcusklaas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcusklaas/subscriptions","organizations_url":"https://api.github.com/users/marcusklaas/orgs","repos_url":"https://api.github.com/users/marcusklaas/repos","events_url":"https://api.github.com/users/marcusklaas/events{/privacy}","received_events_url":"https://api.github.com/users/marcusklaas/received_events","type":"User","site_admin":false},"repo":{"id":34883983,"name":"rustfmt","full_name":"marcusklaas/rustfmt","owner":{"login":"marcusklaas","id":1255413,"avatar_url":"https://avatars.githubusercontent.com/u/1255413?v=3","gravatar_id":"","url":"https://api.github.com/users/marcusklaas","html_url":"https://github.com/marcusklaas","followers_url":"https://api.github.com/users/marcusklaas/followers","following_url":"https://api.github.com/users/marcusklaas/following{/other_user}","gists_url":"https://api.github.com/users/marcusklaas/gists{/gist_id}","starred_url":"https://api.github.com/users/marcusklaas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcusklaas/subscriptions","organizations_url":"https://api.github.com/users/marcusklaas/orgs","repos_url":"https://api.github.com/users/marcusklaas/repos","events_url":"https://api.github.com/users/marcusklaas/events{/privacy}","received_events_url":"https://api.github.com/users/marcusklaas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marcusklaas/rustfmt","description":"Format Rust code","fork":true,"url":"https://api.github.com/repos/marcusklaas/rustfmt","forks_url":"https://api.github.com/repos/marcusklaas/rustfmt/forks","keys_url":"https://api.github.com/repos/marcusklaas/rustfmt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marcusklaas/rustfmt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marcusklaas/rustfmt/teams","hooks_url":"https://api.github.com/repos/marcusklaas/rustfmt/hooks","issue_events_url":"https://api.github.com/repos/marcusklaas/rustfmt/issues/events{/number}","events_url":"https://api.github.com/repos/marcusklaas/rustfmt/events","assignees_url":"https://api.github.com/repos/marcusklaas/rustfmt/assignees{/user}","branches_url":"https://api.github.com/repos/marcusklaas/rustfmt/branches{/branch}","tags_url":"https://api.github.com/repos/marcusklaas/rustfmt/tags","blobs_url":"https://api.github.com/repos/marcusklaas/rustfmt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marcusklaas/rustfmt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marcusklaas/rustfmt/git/refs{/sha}","trees_url":"https://api.github.com/repos/marcusklaas/rustfmt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marcusklaas/rustfmt/statuses/{sha}","languages_url":"https://api.github.com/repos/marcusklaas/rustfmt/languages","stargazers_url":"https://api.github.com/repos/marcusklaas/rustfmt/stargazers","contributors_url":"https://api.github.com/repos/marcusklaas/rustfmt/contributors","subscribers_url":"https://api.github.com/repos/marcusklaas/rustfmt/subscribers","subscription_url":"https://api.github.com/repos/marcusklaas/rustfmt/subscription","commits_url":"https://api.github.com/repos/marcusklaas/rustfmt/commits{/sha}","git_commits_url":"https://api.github.com/repos/marcusklaas/rustfmt/git/commits{/sha}","comments_url":"https://api.github.com/repos/marcusklaas/rustfmt/comments{/number}","issue_comment_url":"https://api.github.com/repos/marcusklaas/rustfmt/issues/comments{/number}","contents_url":"https://api.github.com/repos/marcusklaas/rustfmt/contents/{+path}","compare_url":"https://api.github.com/repos/marcusklaas/rustfmt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marcusklaas/rustfmt/merges","archive_url":"https://api.github.com/repos/marcusklaas/rustfmt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marcusklaas/rustfmt/downloads","issues_url":"https://api.github.com/repos/marcusklaas/rustfmt/issues{/number}","pulls_url":"https://api.github.com/repos/marcusklaas/rustfmt/pulls{/number}","milestones_url":"https://api.github.com/repos/marcusklaas/rustfmt/milestones{/number}","notifications_url":"https://api.github.com/repos/marcusklaas/rustfmt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marcusklaas/rustfmt/labels{/name}","releases_url":"https://api.github.com/repos/marcusklaas/rustfmt/releases{/id}","created_at":"2015-05-01T00:49:35Z","updated_at":"2015-05-02T14:21:36Z","pushed_at":"2015-09-18T20:34:51Z","git_url":"git://github.com/marcusklaas/rustfmt.git","ssh_url":"git@github.com:marcusklaas/rustfmt.git","clone_url":"https://github.com/marcusklaas/rustfmt.git","svn_url":"https://github.com/marcusklaas/rustfmt","homepage":null,"size":1159,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nrc:master","ref":"master","sha":"9c5dc294160bfd5edfa532295bf8cf0befb16b78","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},"repo":{"id":31830551,"name":"rustfmt","full_name":"nrc/rustfmt","owner":{"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},"private":false,"html_url":"https://github.com/nrc/rustfmt","description":"Format Rust code","fork":false,"url":"https://api.github.com/repos/nrc/rustfmt","forks_url":"https://api.github.com/repos/nrc/rustfmt/forks","keys_url":"https://api.github.com/repos/nrc/rustfmt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nrc/rustfmt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nrc/rustfmt/teams","hooks_url":"https://api.github.com/repos/nrc/rustfmt/hooks","issue_events_url":"https://api.github.com/repos/nrc/rustfmt/issues/events{/number}","events_url":"https://api.github.com/repos/nrc/rustfmt/events","assignees_url":"https://api.github.com/repos/nrc/rustfmt/assignees{/user}","branches_url":"https://api.github.com/repos/nrc/rustfmt/branches{/branch}","tags_url":"https://api.github.com/repos/nrc/rustfmt/tags","blobs_url":"https://api.github.com/repos/nrc/rustfmt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nrc/rustfmt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nrc/rustfmt/git/refs{/sha}","trees_url":"https://api.github.com/repos/nrc/rustfmt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nrc/rustfmt/statuses/{sha}","languages_url":"https://api.github.com/repos/nrc/rustfmt/languages","stargazers_url":"https://api.github.com/repos/nrc/rustfmt/stargazers","contributors_url":"https://api.github.com/repos/nrc/rustfmt/contributors","subscribers_url":"https://api.github.com/repos/nrc/rustfmt/subscribers","subscription_url":"https://api.github.com/repos/nrc/rustfmt/subscription","commits_url":"https://api.github.com/repos/nrc/rustfmt/commits{/sha}","git_commits_url":"https://api.github.com/repos/nrc/rustfmt/git/commits{/sha}","comments_url":"https://api.github.com/repos/nrc/rustfmt/comments{/number}","issue_comment_url":"https://api.github.com/repos/nrc/rustfmt/issues/comments{/number}","contents_url":"https://api.github.com/repos/nrc/rustfmt/contents/{+path}","compare_url":"https://api.github.com/repos/nrc/rustfmt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nrc/rustfmt/merges","archive_url":"https://api.github.com/repos/nrc/rustfmt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nrc/rustfmt/downloads","issues_url":"https://api.github.com/repos/nrc/rustfmt/issues{/number}","pulls_url":"https://api.github.com/repos/nrc/rustfmt/pulls{/number}","milestones_url":"https://api.github.com/repos/nrc/rustfmt/milestones{/number}","notifications_url":"https://api.github.com/repos/nrc/rustfmt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nrc/rustfmt/labels{/name}","releases_url":"https://api.github.com/repos/nrc/rustfmt/releases{/id}","created_at":"2015-03-07T22:51:56Z","updated_at":"2015-09-18T17:43:27Z","pushed_at":"2015-09-18T20:37:09Z","git_url":"git://github.com/nrc/rustfmt.git","ssh_url":"git@github.com:nrc/rustfmt.git","clone_url":"https://github.com/nrc/rustfmt.git","svn_url":"https://github.com/nrc/rustfmt","homepage":null,"size":2122,"stargazers_count":339,"watchers_count":339,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":45,"mirror_url":null,"open_issues_count":90,"forks":45,"open_issues":90,"watchers":339,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nrc/rustfmt/pulls/326"},"html":{"href":"https://github.com/nrc/rustfmt/pull/326"},"issue":{"href":"https://api.github.com/repos/nrc/rustfmt/issues/326"},"comments":{"href":"https://api.github.com/repos/nrc/rustfmt/issues/326/comments"},"review_comments":{"href":"https://api.github.com/repos/nrc/rustfmt/pulls/326/comments"},"review_comment":{"href":"https://api.github.com/repos/nrc/rustfmt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nrc/rustfmt/pulls/326/commits"},"statuses":{"href":"https://api.github.com/repos/nrc/rustfmt/statuses/e72d4882819d8d747746199ade3adcf06292e3a3"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"marcusklaas","id":1255413,"avatar_url":"https://avatars.githubusercontent.com/u/1255413?v=3","gravatar_id":"","url":"https://api.github.com/users/marcusklaas","html_url":"https://github.com/marcusklaas","followers_url":"https://api.github.com/users/marcusklaas/followers","following_url":"https://api.github.com/users/marcusklaas/following{/other_user}","gists_url":"https://api.github.com/users/marcusklaas/gists{/gist_id}","starred_url":"https://api.github.com/users/marcusklaas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcusklaas/subscriptions","organizations_url":"https://api.github.com/users/marcusklaas/orgs","repos_url":"https://api.github.com/users/marcusklaas/repos","events_url":"https://api.github.com/users/marcusklaas/events{/privacy}","received_events_url":"https://api.github.com/users/marcusklaas/received_events","type":"User","site_admin":false},"comments":7,"review_comments":3,"commits":2,"additions":212,"deletions":166,"changed_files":10}}