]> git.lizzy.rs Git - rust.git/commit
Auto merge of #5911 - hegza:issue-568, r=ebroto
authorbors <bors@rust-lang.org>
Wed, 4 Nov 2020 22:21:44 +0000 (22:21 +0000)
committerbors <bors@rust-lang.org>
Wed, 4 Nov 2020 22:21:44 +0000 (22:21 +0000)
commit5b52474ae6a63a69e40f4f163ddfbd3548ddac7d
treec250b39469e42342fafc4897a6d1c1c248bc8291
parent62c0d29f17a8b55003580d262882e3ce68ef46e8
parent7b203f3da6b590059c12bb01d0873b31be347928
Auto merge of #5911 - hegza:issue-568, r=ebroto

Add lint for 'field_reassign_with_default` #568

changelog: Add lint for field_reassign_with_default that checks if mutable object + field modification is used to edit a binding initialized with Default::default() instead of struct constructor.

Fixes #568

Notes:
- Checks for reassignment of one or more fields of a binding initialized with Default::default().
- Implemented using EarlyLintPass, might be future proofed better with LateLintPass.
- Does not trigger if Default::default() is used via another type implementing Default.
- This is a re-open of [PR#4761](https://github.com/rust-lang/rust-clippy/pull/4761), but I couldn't figure out how to re-open that one so here's a new one with the requested changes :S
CHANGELOG.md
clippy_lints/src/lib.rs
src/lintlist/mod.rs