]> git.lizzy.rs Git - rust.git/blob - tests/ui/dlist.rs
Auto merge of #68717 - petrochenkov:stabexpat, r=varkor
[rust.git] / tests / ui / dlist.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 trait Foo {
9     type Baz = LinkedList<u8>;
10     fn foo(_: LinkedList<u8>);
11     const BAR: Option<LinkedList<u8>>;
12 }
13
14 // Ok, we don’t want to warn for implementations; see issue #605.
15 impl Foo for LinkedList<u8> {
16     fn foo(_: LinkedList<u8>) {}
17     const BAR: Option<LinkedList<u8>> = None;
18 }
19
20 struct Bar;
21 impl Bar {
22     fn foo(_: LinkedList<u8>) {}
23 }
24
25 pub fn test(my_favourite_linked_list: LinkedList<u8>) {
26     println!("{:?}", my_favourite_linked_list)
27 }
28
29 pub fn test_ret() -> Option<LinkedList<u8>> {
30     unimplemented!();
31 }
32
33 pub fn test_local_not_linted() {
34     let _: LinkedList<u8>;
35 }
36
37 fn main() {
38     test(LinkedList::new());
39     test_local_not_linted();
40 }