mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-11 07:34:18 +00:00
Add false positive test for iterator method
This commit is contained in:
parent
b4d76b42fd
commit
e9f56f949d
2 changed files with 13 additions and 1 deletions
|
@ -53,3 +53,12 @@ impl IteratorFalsePositives {
|
|||
self.foo as usize
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct IteratorMethodFalsePositives;
|
||||
|
||||
impl IteratorMethodFalsePositives {
|
||||
pub fn filter(&self, _s: i32) -> std::vec::IntoIter<i32> {
|
||||
unimplemented!();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ use std::ops::Mul;
|
|||
use std::rc::{self, Rc};
|
||||
use std::sync::{self, Arc};
|
||||
|
||||
use option_helpers::IteratorFalsePositives;
|
||||
use option_helpers::{IteratorFalsePositives, IteratorMethodFalsePositives};
|
||||
|
||||
struct Lt<'a> {
|
||||
foo: &'a u32,
|
||||
|
@ -131,6 +131,9 @@ fn filter_next() {
|
|||
// Check that we don't lint if the caller is not an `Iterator`.
|
||||
let foo = IteratorFalsePositives { foo: 0 };
|
||||
let _ = foo.filter().next();
|
||||
|
||||
let foo = IteratorMethodFalsePositives {};
|
||||
let _ = foo.filter(42).next();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
Loading…
Reference in a new issue