Fix false positive in needless_pass_by_value trait methods

This commit is contained in:
sinkuu 2017-11-07 06:33:25 +09:00
parent 00081be73d
commit 6fb736bd42
2 changed files with 10 additions and 1 deletions

View file

@ -87,7 +87,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
// Exclude non-inherent impls
if let Some(NodeItem(item)) = cx.tcx.hir.find(cx.tcx.hir.get_parent_node(node_id)) {
if matches!(item.node, ItemImpl(_, _, _, _, Some(_), _, _) | ItemAutoImpl(..)) {
if matches!(item.node, ItemImpl(_, _, _, _, Some(_), _, _) | ItemAutoImpl(..) |
ItemTrait(..))
{
return;
}
}

View file

@ -103,4 +103,11 @@ impl<T: Serialize, U> S<T, U> {
}
}
trait FalsePositive {
fn visit_str(s: &str);
fn visit_string(s: String) {
Self::visit_str(&s);
}
}
fn main() {}