]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/dlist.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / dlist.rs
CommitLineData
f20569fa
XL
1#![feature(associated_type_defaults)]
2#![warn(clippy::linkedlist)]
3#![allow(dead_code, clippy::needless_pass_by_value)]
4
5extern crate alloc;
6use alloc::collections::linked_list::LinkedList;
7
8trait 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.
15impl Foo for LinkedList<u8> {
16 fn foo(_: LinkedList<u8>) {}
17 const BAR: Option<LinkedList<u8>> = None;
18}
19
20struct Bar;
21impl Bar {
22 fn foo(_: LinkedList<u8>) {}
23}
24
25pub fn test(my_favourite_linked_list: LinkedList<u8>) {
26 println!("{:?}", my_favourite_linked_list)
27}
28
29pub fn test_ret() -> Option<LinkedList<u8>> {
30 unimplemented!();
31}
32
33pub fn test_local_not_linted() {
34 let _: LinkedList<u8>;
35}
36
37fn main() {
38 test(LinkedList::new());
39 test_local_not_linted();
40}