Add false positive test for iterator method
This commit is contained in:
parent
b4d76b42fd
commit
e9f56f949d
@ -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…
x
Reference in New Issue
Block a user