Merge pull request #2148 from sinkuu/proc_macro

needless_pass_by_value false-positive in annotation
This commit is contained in:
Oliver Schneider 2017-10-20 11:12:21 +02:00 committed by GitHub
commit 281bd790de
3 changed files with 29 additions and 5 deletions

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