diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/tools/clippy/tests/ui/redundant_allocation_fixable.fixed | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/tools/clippy/tests/ui/redundant_allocation_fixable.fixed | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/redundant_allocation_fixable.fixed b/src/tools/clippy/tests/ui/redundant_allocation_fixable.fixed new file mode 100644 index 000000000..e7ed84731 --- /dev/null +++ b/src/tools/clippy/tests/ui/redundant_allocation_fixable.fixed @@ -0,0 +1,75 @@ +// run-rustfix +#![warn(clippy::all)] +#![allow(clippy::boxed_local, clippy::needless_pass_by_value)] +#![allow(clippy::blacklisted_name, unused_variables, dead_code)] +#![allow(unused_imports)] + +pub struct MyStruct; + +pub struct SubT<T> { + foo: T, +} + +pub enum MyEnum { + One, + Two, +} + +mod outer_box { + use crate::MyEnum; + use crate::MyStruct; + use crate::SubT; + use std::boxed::Box; + use std::rc::Rc; + use std::sync::Arc; + + pub fn box_test1<T>(foo: &T) {} + + pub fn box_test2(foo: &MyStruct) {} + + pub fn box_test3(foo: &MyEnum) {} + + pub fn box_test4_neg(foo: Box<SubT<&usize>>) {} + + pub fn box_test5<T>(foo: Box<T>) {} +} + +mod outer_rc { + use crate::MyEnum; + use crate::MyStruct; + use crate::SubT; + use std::boxed::Box; + use std::rc::Rc; + use std::sync::Arc; + + pub fn rc_test1<T>(foo: &T) {} + + pub fn rc_test2(foo: &MyStruct) {} + + pub fn rc_test3(foo: &MyEnum) {} + + pub fn rc_test4_neg(foo: Rc<SubT<&usize>>) {} + + pub fn rc_test6(a: Rc<bool>) {} +} + +mod outer_arc { + use crate::MyEnum; + use crate::MyStruct; + use crate::SubT; + use std::boxed::Box; + use std::rc::Rc; + use std::sync::Arc; + + pub fn arc_test1<T>(foo: &T) {} + + pub fn arc_test2(foo: &MyStruct) {} + + pub fn arc_test3(foo: &MyEnum) {} + + pub fn arc_test4_neg(foo: Arc<SubT<&usize>>) {} + + pub fn arc_test7(a: Arc<bool>) {} +} + +fn main() {} |