Detect proc-macro in needless_pass_by_value

Fixes #1876
This commit is contained in:
sinkuu 2017-10-18 07:29:47 +09:00
parent 4d9ed8beef
commit b4ea47d23e

View File

@ -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`)