Skip to content

Commit

Permalink
Add test where container is passed to a function
Browse files Browse the repository at this point in the history
  • Loading branch information
schubart committed Mar 6, 2023
1 parent 85ad8a6 commit 4ee6553
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/ui/collection_is_never_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,13 @@ fn extension_traits() {
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);
}

0 comments on commit 4ee6553

Please sign in to comment.