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,
24 extern crate option_helpers;
26 use std::collections::BTreeMap;
27 use std::collections::HashMap;
28 use std::collections::HashSet;
29 use std::collections::VecDeque;
31 use std::rc::{self, Rc};
32 use std::sync::{self, Arc};
34 use option_helpers::{IteratorFalsePositives, IteratorMethodFalsePositives};
41 // The lifetime is different, but that’s irrelevant; see issue #734.
42 #[allow(clippy::needless_lifetimes)]
43 pub fn new<'b>(s: &'b str) -> Lt<'b> {
53 // The lifetime is different, but that’s irrelevant; see issue #734.
54 pub fn new(s: &str) -> Lt2 {
64 // The lifetime is different, but that’s irrelevant; see issue #734.
65 pub fn new() -> Lt3<'static> {
70 #[derive(Clone, Copy)]
77 // Ok because `U` is `Copy`.
78 fn to_something(self) -> u32 {
88 fn new() -> Option<V<T>> {
96 async fn new() -> Option<Self> {
113 // No error, obviously.
114 fn mul(self, other: T) -> T {
119 /// Checks implementation of `FILTER_NEXT` lint.
122 let v = vec![3, 2, 1, 0, -1, -2, -3];
125 let _ = v.iter().filter(|&x| {
130 // Check that we don't lint if the caller is not an `Iterator`.
131 let foo = IteratorFalsePositives { foo: 0 };
132 let _ = foo.filter().next();
134 let foo = IteratorMethodFalsePositives {};
135 let _ = foo.filter(42).next();