{"action":"created","comment":{"url":"https://api.github.com/repos/serde-rs/serde/pulls/comments/77427699","id":77427699,"diff_hunk":"@@ -226,9 +227,10 @@ fn serialize_tuple_struct(\n \n     let type_name = name_expr(builder, item_attrs.name());\n     let len = serialize_stmts.len();\n+    let let_mut = mut_if_nonzero(cx, len);\n \n     quote_block!(cx, {\n-        let mut state = try!(_serializer.serialize_tuple_struct($type_name, $len));\n+        let $let_mut state = try!(_serializer.serialize_tuple_struct($type_name, $len));\n         $serialize_stmts","path":"serde_codegen/src/ser.rs","position":17,"original_position":17,"commit_id":"14446af53750958303a2bf6956562f5fd7f9eed7","original_commit_id":"14446af53750958303a2bf6956562f5fd7f9eed7","user":{"login":"dtolnay","id":1940490,"avatar_url":"https://avatars.githubusercontent.com/u/1940490?v=3","gravatar_id":"","url":"https://api.github.com/users/dtolnay","html_url":"https://github.com/dtolnay","followers_url":"https://api.github.com/users/dtolnay/followers","following_url":"https://api.github.com/users/dtolnay/following{/other_user}","gists_url":"https://api.github.com/users/dtolnay/gists{/gist_id}","starred_url":"https://api.github.com/users/dtolnay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtolnay/subscriptions","organizations_url":"https://api.github.com/users/dtolnay/orgs","repos_url":"https://api.github.com/users/dtolnay/repos","events_url":"https://api.github.com/users/dtolnay/events{/privacy}","received_events_url":"https://api.github.com/users/dtolnay/received_events","type":"User","site_admin":false},"body":"@nox I think I would rather move in the opposite direction, of making our generated code more straightforward where that can be accomplished easily. See as examples #479 and #538. There are a few reasons that is valuable:\r\n\r\n1. The most straightforward code will give us (and others) the best experience when the generated code needs to be debugged.\r\n2. The generated code is valuable as a template for implementing Serialize and Deserialize manually with minor modifications.\r\n3. Convoluted generated code gives people the impression that Serde is hard or Serde codegen is magic and impossible to understand, scaring people away from implementing Serialize and Deserialize manually where necessary.\r\n\r\nI'm not saying we need to make the generated code beautiful at the expense of maintainability of serde_codegen, but there is a middle ground and I don't think rolling `let mut state = state` into `$serialize_stmts` is the right tradeoff in this case. Thanks for the idea though!","created_at":"2016-09-03T00:40:28Z","updated_at":"2016-09-03T00:40:28Z","html_url":"https://github.com/serde-rs/serde/pull/536#discussion_r77427699","pull_request_url":"https://api.github.com/repos/serde-rs/serde/pulls/536","_links":{"self":{"href":"https://api.github.com/repos/serde-rs/serde/pulls/comments/77427699"},"html":{"href":"https://github.com/serde-rs/serde/pull/536#discussion_r77427699"},"pull_request":{"href":"https://api.github.com/repos/serde-rs/serde/pulls/536"}}},"pull_request":{"url":"https://api.github.com/repos/serde-rs/serde/pulls/536","id":83847259,"html_url":"https://github.com/serde-rs/serde/pull/536","diff_url":"https://github.com/serde-rs/serde/pull/536.diff","patch_url":"https://github.com/serde-rs/serde/pull/536.patch","issue_url":"https://api.github.com/repos/serde-rs/serde/issues/536","number":536,"state":"open","locked":false,"title":"Fix \"variable does not need to be mutable\" warning","user":{"login":"dtolnay","id":1940490,"avatar_url":"https://avatars.githubusercontent.com/u/1940490?v=3","gravatar_id":"","url":"https://api.github.com/users/dtolnay","html_url":"https://github.com/dtolnay","followers_url":"https://api.github.com/users/dtolnay/followers","following_url":"https://api.github.com/users/dtolnay/following{/other_user}","gists_url":"https://api.github.com/users/dtolnay/gists{/gist_id}","starred_url":"https://api.github.com/users/dtolnay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtolnay/subscriptions","organizations_url":"https://api.github.com/users/dtolnay/orgs","repos_url":"https://api.github.com/users/dtolnay/repos","events_url":"https://api.github.com/users/dtolnay/events{/privacy}","received_events_url":"https://api.github.com/users/dtolnay/received_events","type":"User","site_admin":false},"body":"Fixes #534.\r\n\r\ncc @EliDupree","created_at":"2016-09-02T18:43:30Z","updated_at":"2016-09-03T00:40:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"479f851e024322ef5b2af007e0bb6c118bc971ed","assignee":{"login":"oli-obk","id":332036,"avatar_url":"https://avatars.githubusercontent.com/u/332036?v=3","gravatar_id":"","url":"https://api.github.com/users/oli-obk","html_url":"https://github.com/oli-obk","followers_url":"https://api.github.com/users/oli-obk/followers","following_url":"https://api.github.com/users/oli-obk/following{/other_user}","gists_url":"https://api.github.com/users/oli-obk/gists{/gist_id}","starred_url":"https://api.github.com/users/oli-obk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oli-obk/subscriptions","organizations_url":"https://api.github.com/users/oli-obk/orgs","repos_url":"https://api.github.com/users/oli-obk/repos","events_url":"https://api.github.com/users/oli-obk/events{/privacy}","received_events_url":"https://api.github.com/users/oli-obk/received_events","type":"User","site_admin":false},"assignees":[{"login":"oli-obk","id":332036,"avatar_url":"https://avatars.githubusercontent.com/u/332036?v=3","gravatar_id":"","url":"https://api.github.com/users/oli-obk","html_url":"https://github.com/oli-obk","followers_url":"https://api.github.com/users/oli-obk/followers","following_url":"https://api.github.com/users/oli-obk/following{/other_user}","gists_url":"https://api.github.com/users/oli-obk/gists{/gist_id}","starred_url":"https://api.github.com/users/oli-obk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oli-obk/subscriptions","organizations_url":"https://api.github.com/users/oli-obk/orgs","repos_url":"https://api.github.com/users/oli-obk/repos","events_url":"https://api.github.com/users/oli-obk/events{/privacy}","received_events_url":"https://api.github.com/users/oli-obk/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/serde-rs/serde/pulls/536/commits","review_comments_url":"https://api.github.com/repos/serde-rs/serde/pulls/536/comments","review_comment_url":"https://api.github.com/repos/serde-rs/serde/pulls/comments{/number}","comments_url":"https://api.github.com/repos/serde-rs/serde/issues/536/comments","statuses_url":"https://api.github.com/repos/serde-rs/serde/statuses/14446af53750958303a2bf6956562f5fd7f9eed7","head":{"label":"serde-rs:mutempty","ref":"mutempty","sha":"14446af53750958303a2bf6956562f5fd7f9eed7","user":{"login":"serde-rs","id":11965399,"avatar_url":"https://avatars.githubusercontent.com/u/11965399?v=3","gravatar_id":"","url":"https://api.github.com/users/serde-rs","html_url":"https://github.com/serde-rs","followers_url":"https://api.github.com/users/serde-rs/followers","following_url":"https://api.github.com/users/serde-rs/following{/other_user}","gists_url":"https://api.github.com/users/serde-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/serde-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serde-rs/subscriptions","organizations_url":"https://api.github.com/users/serde-rs/orgs","repos_url":"https://api.github.com/users/serde-rs/repos","events_url":"https://api.github.com/users/serde-rs/events{/privacy}","received_events_url":"https://api.github.com/users/serde-rs/received_events","type":"Organization","site_admin":false},"repo":{"id":14367737,"name":"serde","full_name":"serde-rs/serde","owner":{"login":"serde-rs","id":11965399,"avatar_url":"https://avatars.githubusercontent.com/u/11965399?v=3","gravatar_id":"","url":"https://api.github.com/users/serde-rs","html_url":"https://github.com/serde-rs","followers_url":"https://api.github.com/users/serde-rs/followers","following_url":"https://api.github.com/users/serde-rs/following{/other_user}","gists_url":"https://api.github.com/users/serde-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/serde-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serde-rs/subscriptions","organizations_url":"https://api.github.com/users/serde-rs/orgs","repos_url":"https://api.github.com/users/serde-rs/repos","events_url":"https://api.github.com/users/serde-rs/events{/privacy}","received_events_url":"https://api.github.com/users/serde-rs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/serde-rs/serde","description":"Serialization framework for Rust","fork":false,"url":"https://api.github.com/repos/serde-rs/serde","forks_url":"https://api.github.com/repos/serde-rs/serde/forks","keys_url":"https://api.github.com/repos/serde-rs/serde/keys{/key_id}","collaborators_url":"https://api.github.com/repos/serde-rs/serde/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/serde-rs/serde/teams","hooks_url":"https://api.github.com/repos/serde-rs/serde/hooks","issue_events_url":"https://api.github.com/repos/serde-rs/serde/issues/events{/number}","events_url":"https://api.github.com/repos/serde-rs/serde/events","assignees_url":"https://api.github.com/repos/serde-rs/serde/assignees{/user}","branches_url":"https://api.github.com/repos/serde-rs/serde/branches{/branch}","tags_url":"https://api.github.com/repos/serde-rs/serde/tags","blobs_url":"https://api.github.com/repos/serde-rs/serde/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/serde-rs/serde/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/serde-rs/serde/git/refs{/sha}","trees_url":"https://api.github.com/repos/serde-rs/serde/git/trees{/sha}","statuses_url":"https://api.github.com/repos/serde-rs/serde/statuses/{sha}","languages_url":"https://api.github.com/repos/serde-rs/serde/languages","stargazers_url":"https://api.github.com/repos/serde-rs/serde/stargazers","contributors_url":"https://api.github.com/repos/serde-rs/serde/contributors","subscribers_url":"https://api.github.com/repos/serde-rs/serde/subscribers","subscription_url":"https://api.github.com/repos/serde-rs/serde/subscription","commits_url":"https://api.github.com/repos/serde-rs/serde/commits{/sha}","git_commits_url":"https://api.github.com/repos/serde-rs/serde/git/commits{/sha}","comments_url":"https://api.github.com/repos/serde-rs/serde/comments{/number}","issue_comment_url":"https://api.github.com/repos/serde-rs/serde/issues/comments{/number}","contents_url":"https://api.github.com/repos/serde-rs/serde/contents/{+path}","compare_url":"https://api.github.com/repos/serde-rs/serde/compare/{base}...{head}","merges_url":"https://api.github.com/repos/serde-rs/serde/merges","archive_url":"https://api.github.com/repos/serde-rs/serde/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/serde-rs/serde/downloads","issues_url":"https://api.github.com/repos/serde-rs/serde/issues{/number}","pulls_url":"https://api.github.com/repos/serde-rs/serde/pulls{/number}","milestones_url":"https://api.github.com/repos/serde-rs/serde/milestones{/number}","notifications_url":"https://api.github.com/repos/serde-rs/serde/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/serde-rs/serde/labels{/name}","releases_url":"https://api.github.com/repos/serde-rs/serde/releases{/id}","deployments_url":"https://api.github.com/repos/serde-rs/serde/deployments","created_at":"2013-11-13T15:22:58Z","updated_at":"2016-09-02T11:53:12Z","pushed_at":"2016-09-03T00:26:08Z","git_url":"git://github.com/serde-rs/serde.git","ssh_url":"git@github.com:serde-rs/serde.git","clone_url":"https://github.com/serde-rs/serde.git","svn_url":"https://github.com/serde-rs/serde","homepage":"https://serde.rs/","size":3101,"stargazers_count":485,"watchers_count":485,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":84,"mirror_url":null,"open_issues_count":53,"forks":84,"open_issues":53,"watchers":485,"default_branch":"master"}},"base":{"label":"serde-rs:master","ref":"master","sha":"248d937f9a969a5dec5ffef7ae0e100e3c3fec5f","user":{"login":"serde-rs","id":11965399,"avatar_url":"https://avatars.githubusercontent.com/u/11965399?v=3","gravatar_id":"","url":"https://api.github.com/users/serde-rs","html_url":"https://github.com/serde-rs","followers_url":"https://api.github.com/users/serde-rs/followers","following_url":"https://api.github.com/users/serde-rs/following{/other_user}","gists_url":"https://api.github.com/users/serde-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/serde-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serde-rs/subscriptions","organizations_url":"https://api.github.com/users/serde-rs/orgs","repos_url":"https://api.github.com/users/serde-rs/repos","events_url":"https://api.github.com/users/serde-rs/events{/privacy}","received_events_url":"https://api.github.com/users/serde-rs/received_events","type":"Organization","site_admin":false},"repo":{"id":14367737,"name":"serde","full_name":"serde-rs/serde","owner":{"login":"serde-rs","id":11965399,"avatar_url":"https://avatars.githubusercontent.com/u/11965399?v=3","gravatar_id":"","url":"https://api.github.com/users/serde-rs","html_url":"https://github.com/serde-rs","followers_url":"https://api.github.com/users/serde-rs/followers","following_url":"https://api.github.com/users/serde-rs/following{/other_user}","gists_url":"https://api.github.com/users/serde-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/serde-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serde-rs/subscriptions","organizations_url":"https://api.github.com/users/serde-rs/orgs","repos_url":"https://api.github.com/users/serde-rs/repos","events_url":"https://api.github.com/users/serde-rs/events{/privacy}","received_events_url":"https://api.github.com/users/serde-rs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/serde-rs/serde","description":"Serialization framework for Rust","fork":false,"url":"https://api.github.com/repos/serde-rs/serde","forks_url":"https://api.github.com/repos/serde-rs/serde/forks","keys_url":"https://api.github.com/repos/serde-rs/serde/keys{/key_id}","collaborators_url":"https://api.github.com/repos/serde-rs/serde/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/serde-rs/serde/teams","hooks_url":"https://api.github.com/repos/serde-rs/serde/hooks","issue_events_url":"https://api.github.com/repos/serde-rs/serde/issues/events{/number}","events_url":"https://api.github.com/repos/serde-rs/serde/events","assignees_url":"https://api.github.com/repos/serde-rs/serde/assignees{/user}","branches_url":"https://api.github.com/repos/serde-rs/serde/branches{/branch}","tags_url":"https://api.github.com/repos/serde-rs/serde/tags","blobs_url":"https://api.github.com/repos/serde-rs/serde/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/serde-rs/serde/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/serde-rs/serde/git/refs{/sha}","trees_url":"https://api.github.com/repos/serde-rs/serde/git/trees{/sha}","statuses_url":"https://api.github.com/repos/serde-rs/serde/statuses/{sha}","languages_url":"https://api.github.com/repos/serde-rs/serde/languages","stargazers_url":"https://api.github.com/repos/serde-rs/serde/stargazers","contributors_url":"https://api.github.com/repos/serde-rs/serde/contributors","subscribers_url":"https://api.github.com/repos/serde-rs/serde/subscribers","subscription_url":"https://api.github.com/repos/serde-rs/serde/subscription","commits_url":"https://api.github.com/repos/serde-rs/serde/commits{/sha}","git_commits_url":"https://api.github.com/repos/serde-rs/serde/git/commits{/sha}","comments_url":"https://api.github.com/repos/serde-rs/serde/comments{/number}","issue_comment_url":"https://api.github.com/repos/serde-rs/serde/issues/comments{/number}","contents_url":"https://api.github.com/repos/serde-rs/serde/contents/{+path}","compare_url":"https://api.github.com/repos/serde-rs/serde/compare/{base}...{head}","merges_url":"https://api.github.com/repos/serde-rs/serde/merges","archive_url":"https://api.github.com/repos/serde-rs/serde/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/serde-rs/serde/downloads","issues_url":"https://api.github.com/repos/serde-rs/serde/issues{/number}","pulls_url":"https://api.github.com/repos/serde-rs/serde/pulls{/number}","milestones_url":"https://api.github.com/repos/serde-rs/serde/milestones{/number}","notifications_url":"https://api.github.com/repos/serde-rs/serde/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/serde-rs/serde/labels{/name}","releases_url":"https://api.github.com/repos/serde-rs/serde/releases{/id}","deployments_url":"https://api.github.com/repos/serde-rs/serde/deployments","created_at":"2013-11-13T15:22:58Z","updated_at":"2016-09-02T11:53:12Z","pushed_at":"2016-09-03T00:26:08Z","git_url":"git://github.com/serde-rs/serde.git","ssh_url":"git@github.com:serde-rs/serde.git","clone_url":"https://github.com/serde-rs/serde.git","svn_url":"https://github.com/serde-rs/serde","homepage":"https://serde.rs/","size":3101,"stargazers_count":485,"watchers_count":485,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":84,"mirror_url":null,"open_issues_count":53,"forks":84,"open_issues":53,"watchers":485,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/serde-rs/serde/pulls/536"},"html":{"href":"https://github.com/serde-rs/serde/pull/536"},"issue":{"href":"https://api.github.com/repos/serde-rs/serde/issues/536"},"comments":{"href":"https://api.github.com/repos/serde-rs/serde/issues/536/comments"},"review_comments":{"href":"https://api.github.com/repos/serde-rs/serde/pulls/536/comments"},"review_comment":{"href":"https://api.github.com/repos/serde-rs/serde/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/serde-rs/serde/pulls/536/commits"},"statuses":{"href":"https://api.github.com/repos/serde-rs/serde/statuses/14446af53750958303a2bf6956562f5fd7f9eed7"}}}}
{"actor":{"display_login":"dtolnay"}}