Skip to content

Commit

Permalink
Detect proc-macro in needless_pass_by_value
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkuu authored and gbip committed Oct 20, 2017
1 parent 0bfcbd0 commit 509f7a1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clippy_lints/src/needless_pass_by_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
.zip(&body.arguments)
.enumerate()
{
// All spans generated from a proc-macro invocation are the same...
if span == input.span {
return;
}

// * Exclude a type that is specifically bounded by `Borrow`.
// * Exclude a type whose reference also fulfills its bound.
// (e.g. `std::convert::AsRef`, `serde::Serialize`)
Expand Down

0 comments on commit 509f7a1

Please sign in to comment.