about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/graph.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-07-21 23:02:38 +0000
committerbors <bors@rust-lang.org>2024-07-21 23:02:38 +0000
commit1807580a49d31457ca1fd9d3bcbbb9bf1cfd7a34 (patch)
tree85c773d63e49efa8be3b77e021ec41794e9494a6 /compiler/rustc_mir_transform/src/coverage/graph.rs
parent7f0ed112133e0c005bc90f58c9b0325e56c1eb66 (diff)
parent296dcf09fb7e744c8f7b118e2e328dbc1fd6a7a5 (diff)
downloadrust-1807580a49d31457ca1fd9d3bcbbb9bf1cfd7a34.tar.gz
rust-1807580a49d31457ca1fd9d3bcbbb9bf1cfd7a34.zip
Auto merge of #12772 - phi-gamma:redundant-struct-recreation, r=y21
add lint for recreation of an entire struct

This lint makes Clippy warn about situations where an owned struct is
essentially recreated by moving all its fields into a new instance of
the struct. The lint is not machine-applicable because the source
struct may have been partially moved.

This lint originated in something I spotted during peer review. While
working on their branch a colleague ended up with a commit where a
function returned a struct that 1:1 replicated one of its owned inputs
from its members. Initially I suspected they hadn’t run their code
through Clippy but AFAICS there is no lint for this situation yet.

changelog: new lint: [`redundant_owned_struct_recreation`]

### New lint checklist

- \[+] Followed [lint naming conventions][lint_naming]
- \[+] Added passing UI tests (including committed `.stderr` file)
- \[+] `cargo test` passes locally
- \[+] Executed `cargo dev update_lints`
- \[+] Added lint documentation
- \[+] Run `cargo dev fmt`
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/graph.rs')
0 files changed, 0 insertions, 0 deletions