]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/redundant_allocation.fixed
feat(rustdoc): open sidebar menu when links inside it are focused
[rust.git] / src / tools / clippy / tests / ui / redundant_allocation.fixed
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
6 use std::boxed::Box;
7 use std::rc::Rc;
8
9 pub struct MyStruct {}
10
11 pub struct SubT<T> {
12     foo: T,
13 }
14
15 pub enum MyEnum {
16     One,
17     Two,
18 }
19
20 // Rc<&T>
21
22 pub fn test1<T>(foo: &T) {}
23
24 pub fn test2(foo: &MyStruct) {}
25
26 pub fn test3(foo: &MyEnum) {}
27
28 pub fn test4_neg(foo: Rc<SubT<&usize>>) {}
29
30 // Rc<Rc<T>>
31
32 pub fn test5(a: Rc<bool>) {}
33
34 // Rc<Box<T>>
35
36 pub fn test6(a: Rc<bool>) {}
37
38 // Box<&T>
39
40 pub fn test7<T>(foo: &T) {}
41
42 pub fn test8(foo: &MyStruct) {}
43
44 pub fn test9(foo: &MyEnum) {}
45
46 pub fn test10_neg(foo: Box<SubT<&usize>>) {}
47
48 fn main() {}