From 4ee65535a708d6493b1a1d6276e6d06f8e156e14 Mon Sep 17 00:00:00 2001 From: Michael Schubart Date: Mon, 6 Mar 2023 22:19:34 +0000 Subject: [PATCH] Add test where container is passed to a function --- tests/ui/collection_is_never_read.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/ui/collection_is_never_read.rs b/tests/ui/collection_is_never_read.rs index 49c72e7eefe..068a49486cf 100644 --- a/tests/ui/collection_is_never_read.rs +++ b/tests/ui/collection_is_never_read.rs @@ -153,3 +153,13 @@ fn method_without_side_effect(&self) {} let y = vec![1, 2, 3]; // Ok (false negative) y.method_without_side_effect(); } + +fn function_argument() { + #[allow(clippy::ptr_arg)] + fn foo(v: &Vec) -> usize { + v.len() + } + + let x = vec![1, 2, 3]; // Ok + foo(&x); +}