]> git.lizzy.rs Git - rust.git/blob - tests/ui/dlist.rs
Merge pull request #3265 from mikerite/fix-export
[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
11 #![feature(tool_lints)]
12
13 #![feature(alloc)]
14 #![feature(associated_type_defaults)]
15
16
17 #![warn(clippy::linkedlist)]
18 #![allow(dead_code, clippy::needless_pass_by_value)]
19
20 extern crate alloc;
21 use alloc::collections::linked_list::LinkedList;
22
23 trait Foo {
24     type Baz = LinkedList<u8>;
25     fn foo(LinkedList<u8>);
26     const BAR : Option<LinkedList<u8>>;
27 }
28
29 // ok, we don’t want to warn for implementations, see #605
30 impl Foo for LinkedList<u8> {
31     fn foo(_: LinkedList<u8>) {}
32     const BAR : Option<LinkedList<u8>> = None;
33 }
34
35 struct Bar;
36 impl Bar {
37     fn foo(_: LinkedList<u8>) {}
38 }
39
40 pub fn test(my_favourite_linked_list: LinkedList<u8>) {
41     println!("{:?}", my_favourite_linked_list)
42 }
43
44 pub fn test_ret() -> Option<LinkedList<u8>> {
45     unimplemented!();
46 }
47
48 pub fn test_local_not_linted() {
49     let _: LinkedList<u8>;
50 }
51
52 fn main(){
53     test(LinkedList::new());
54     test_local_not_linted();
55 }