about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/errors.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-05-27 14:26:50 +0000
committerbors <bors@rust-lang.org>2024-05-27 14:26:50 +0000
commit7e4c1ae0b6df9d498759ffec150c46f605adeb59 (patch)
tree89b22ea5a3f2456b95b67f729a197cd6b5be705b /compiler/rustc_pattern_analysis/src/errors.rs
parent20f0f135ee1fefa143cbe887471f9d9631f8f052 (diff)
parent4a64180dd5cc48a26b2af3fbe0ddd3da0cccfb82 (diff)
downloadrust-7e4c1ae0b6df9d498759ffec150c46f605adeb59.tar.gz
rust-7e4c1ae0b6df9d498759ffec150c46f605adeb59.zip
Auto merge of #12843 - mdm:fix-unnecessary-to-owned-println-interaction, r=y21
Fix `unnecessary_to_owned` interaction with macro expansion

fixes #12821

In the case of an unnecessary `.iter().cloned()`, the lint `unnecessary_to_owned` might suggest to remove the `&` from references without checking if such references are inside a macro expansion. This can lead to unexpected behavior or even broken code if the lint suggestion is applied blindly. See issue #12821 for an example.

This PR checks if such references are inside macro expansions and skips this part of the lint suggestion in these cases.

changelog: [`unnecessary_to_owned`]: Don't suggest to remove `&` inside macro expansion
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/errors.rs')
0 files changed, 0 insertions, 0 deletions