1 // aux-build:option_helpers.rs
3 #![warn(clippy::all, clippy::pedantic)]
5 clippy::blacklisted_name,
6 clippy::default_trait_access,
7 clippy::missing_docs_in_private_items,
8 clippy::missing_safety_doc,
9 clippy::non_ascii_literal,
10 clippy::new_without_default,
11 clippy::needless_pass_by_value,
12 clippy::needless_lifetimes,
14 clippy::must_use_candidate,
16 clippy::useless_format,
17 clippy::wrong_self_convention,
23 extern crate option_helpers;
25 use std::collections::BTreeMap;
26 use std::collections::HashMap;
27 use std::collections::HashSet;
28 use std::collections::VecDeque;
30 use std::rc::{self, Rc};
31 use std::sync::{self, Arc};
33 use option_helpers::{IteratorFalsePositives, IteratorMethodFalsePositives};
40 // The lifetime is different, but that’s irrelevant; see issue #734.
41 #[allow(clippy::needless_lifetimes)]
42 pub fn new<'b>(s: &'b str) -> Lt<'b> {
52 // The lifetime is different, but that’s irrelevant; see issue #734.
53 pub fn new(s: &str) -> Lt2 {
63 // The lifetime is different, but that’s irrelevant; see issue #734.
64 pub fn new() -> Lt3<'static> {
69 #[derive(Clone, Copy)]
76 // Ok because `U` is `Copy`.
77 fn to_something(self) -> u32 {
87 fn new() -> Option<V<T>> {
95 async fn new() -> Option<Self> {
112 // No error, obviously.
113 fn mul(self, other: T) -> T {
118 /// Checks implementation of `FILTER_NEXT` lint.
121 let v = vec![3, 2, 1, 0, -1, -2, -3];
124 let _ = v.iter().filter(|&x| {
129 // Check that we don't lint if the caller is not an `Iterator`.
130 let foo = IteratorFalsePositives { foo: 0 };
131 let _ = foo.filter().next();
133 let foo = IteratorMethodFalsePositives {};
134 let _ = foo.filter(42).next();