]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/redundant_allocation.fixed
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / redundant_allocation.fixed
CommitLineData
f20569fa
XL
1// run-rustfix
2#![warn(clippy::all)]
3#![allow(clippy::boxed_local, clippy::needless_pass_by_value)]
4#![allow(clippy::blacklisted_name, unused_variables, dead_code)]
5
6use std::boxed::Box;
7use std::rc::Rc;
8
9pub struct MyStruct {}
10
11pub struct SubT<T> {
12 foo: T,
13}
14
15pub enum MyEnum {
16 One,
17 Two,
18}
19
20// Rc<&T>
21
22pub fn test1<T>(foo: &T) {}
23
24pub fn test2(foo: &MyStruct) {}
25
26pub fn test3(foo: &MyEnum) {}
27
28pub fn test4_neg(foo: Rc<SubT<&usize>>) {}
29
30// Rc<Rc<T>>
31
32pub fn test5(a: Rc<bool>) {}
33
34// Rc<Box<T>>
35
36pub fn test6(a: Rc<bool>) {}
37
38// Box<&T>
39
40pub fn test7<T>(foo: &T) {}
41
42pub fn test8(foo: &MyStruct) {}
43
44pub fn test9(foo: &MyEnum) {}
45
46pub fn test10_neg(foo: Box<SubT<&usize>>) {}
47
48fn main() {}