Add test where container is passed to a function

This commit is contained in:
Michael Schubart 2023-03-06 22:19:34 +00:00
parent 85ad8a6fdc
commit 4ee65535a7

View File

@ -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<T>(v: &Vec<T>) -> usize {
v.len()
}
let x = vec![1, 2, 3]; // Ok
foo(&x);
}