1 // aux-build:option_helpers.rs
4 #![warn(clippy::all, clippy::pedantic)]
6 clippy::blacklisted_name,
7 clippy::default_trait_access,
8 clippy::missing_docs_in_private_items,
9 clippy::missing_safety_doc,
10 clippy::non_ascii_literal,
11 clippy::new_without_default,
12 clippy::needless_pass_by_value,
13 clippy::needless_lifetimes,
15 clippy::must_use_candidate,
17 clippy::useless_format,
18 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;
30 use std::iter::FromIterator;
32 use std::rc::{self, Rc};
33 use std::sync::{self, Arc};
35 use option_helpers::IteratorFalsePositives;
42 // The lifetime is different, but that’s irrelevant; see issue #734.
43 #[allow(clippy::needless_lifetimes)]
44 pub fn new<'b>(s: &'b str) -> Lt<'b> {
54 // The lifetime is different, but that’s irrelevant; see issue #734.
55 pub fn new(s: &str) -> Lt2 {
65 // The lifetime is different, but that’s irrelevant; see issue #734.
66 pub fn new() -> Lt3<'static> {
71 #[derive(Clone, Copy)]
78 // Ok because `U` is `Copy`.
79 fn to_something(self) -> u32 {
89 fn new() -> Option<V<T>> {
97 async fn new() -> Option<Self> {
114 // No error, obviously.
115 fn mul(self, other: T) -> T {
120 /// Checks implementation of `FILTER_NEXT` lint.
123 let v = vec![3, 2, 1, 0, -1, -2, -3];
126 let _ = v.iter().filter(|&x| {
131 // Check that we don't lint if the caller is not an `Iterator`.
132 let foo = IteratorFalsePositives { foo: 0 };
133 let _ = foo.filter().next();