mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 13:13:34 +00:00
Fix false positive in needless_pass_by_value trait methods
This commit is contained in:
parent
00081be73d
commit
6fb736bd42
2 changed files with 10 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() {}
|
||||
|
|
Loading…
Reference in a new issue