Skip to content

Commit 509f7a1

Browse files
sinkuugbip
authored andcommitted
Detect proc-macro in needless_pass_by_value
Fixes #1876
1 parent 0bfcbd0 commit 509f7a1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clippy_lints/src/needless_pass_by_value.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
121121
.zip(&body.arguments)
122122
.enumerate()
123123
{
124+
// All spans generated from a proc-macro invocation are the same...
125+
if span == input.span {
126+
return;
127+
}
128+
124129
// * Exclude a type that is specifically bounded by `Borrow`.
125130
// * Exclude a type whose reference also fulfills its bound.
126131
// (e.g. `std::convert::AsRef`, `serde::Serialize`)

0 commit comments

Comments
 (0)