Open
Description
There have been a couple of problems already with broken suggestions with macros.
The snippet
function does not deal with macros very well which is why we have snippet_with_macro_callsite
which uses the original macro unexpanded.
For example if we have some kind x.map(|_| vec![])
code, the redundant_closure
lint would suggest to replace vec![]
with $crate::vec::Vec::new
which should just be Vec::new()
.
cargo clippy --fix
fills in the suggestion and the crate no longer builds because what is x.map(|_| $crate::...
...
I'm wondering, what are valid cases where DO want to have an expanded macro inside a fix suggestion?
Can we fix this class of bugs once and for all by just making the snippet
fn not expand macros by default?
Metadata
Metadata
Assignees
Labels
Category: Clippy is not doing the correct thingCategory: QuestionsIssue: The suggestions provided by this Lint cause an ICE/error when appliedLint: Improving, adding or fixing lint suggestionsStatus: Needs further discussion before merging or work can be startedType: Issues with macros and macro expansion