Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add collection_is_never_read #10415

Merged
merged 7 commits into from
Mar 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test where container is passed to a function
  • Loading branch information
schubart committed Mar 6, 2023
commit 4ee65535a708d6493b1a1d6276e6d06f8e156e14
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);
}