]> git.lizzy.rs Git - rust.git/blob - tests/ui/dlist.rs
Auto merge of #3635 - matthiaskrgr:revert_random_state_3603, r=xfix
[rust.git] / tests / ui / dlist.rs
1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9
10 #![feature(alloc)]
11 #![feature(associated_type_defaults)]
12 #![warn(clippy::linkedlist)]
13 #![allow(dead_code, clippy::needless_pass_by_value)]
14
15 extern crate alloc;
16 use alloc::collections::linked_list::LinkedList;
17
18 trait Foo {
19     type Baz = LinkedList<u8>;
20     fn foo(LinkedList<u8>);
21     const BAR: Option<LinkedList<u8>>;
22 }
23
24 // ok, we don’t want to warn for implementations, see #605
25 impl Foo for LinkedList<u8> {
26     fn foo(_: LinkedList<u8>) {}
27     const BAR: Option<LinkedList<u8>> = None;
28 }
29
30 struct Bar;
31 impl Bar {
32     fn foo(_: LinkedList<u8>) {}
33 }
34
35 pub fn test(my_favourite_linked_list: LinkedList<u8>) {
36     println!("{:?}", my_favourite_linked_list)
37 }
38
39 pub fn test_ret() -> Option<LinkedList<u8>> {
40     unimplemented!();
41 }
42
43 pub fn test_local_not_linted() {
44     let _: LinkedList<u8>;
45 }
46
47 fn main() {
48     test(LinkedList::new());
49     test_local_not_linted();
50 }