]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/linkedlist.rs
Auto merge of #87686 - matthiaskrgr:clippy_august_21_perf, r=jackh726
[rust.git] / src / tools / clippy / tests / ui / linkedlist.rs
1 #![feature(associated_type_defaults)]
2 #![warn(clippy::linkedlist)]
3 #![allow(dead_code, clippy::needless_pass_by_value)]
4
5 extern crate alloc;
6 use alloc::collections::linked_list::LinkedList;
7
8 const C: LinkedList<i32> = LinkedList::new();
9 static S: LinkedList<i32> = LinkedList::new();
10
11 trait Foo {
12     type Baz = LinkedList<u8>;
13     fn foo(_: LinkedList<u8>);
14     const BAR: Option<LinkedList<u8>>;
15 }
16
17 // Ok, we don’t want to warn for implementations; see issue #605.
18 impl Foo for LinkedList<u8> {
19     fn foo(_: LinkedList<u8>) {}
20     const BAR: Option<LinkedList<u8>> = None;
21 }
22
23 struct Bar;
24 impl Bar {
25     fn foo(_: LinkedList<u8>) {}
26 }
27
28 pub fn test(my_favourite_linked_list: LinkedList<u8>) {
29     println!("{:?}", my_favourite_linked_list)
30 }
31
32 pub fn test_ret() -> Option<LinkedList<u8>> {
33     unimplemented!();
34 }
35
36 pub fn test_local_not_linted() {
37     let _: LinkedList<u8>;
38 }
39
40 fn main() {
41     test(LinkedList::new());
42     test_local_not_linted();
43 }