rust/tests/ui/redundant_allocation.fixed

49 lines
706 B
Rust
Raw Normal View History

// run-rustfix
#![warn(clippy::all)]
#![allow(clippy::boxed_local, clippy::needless_pass_by_value)]
#![allow(clippy::blacklisted_name, unused_variables, dead_code)]
use std::boxed::Box;
use std::rc::Rc;
pub struct MyStruct {}
pub struct SubT<T> {
foo: T,
}
pub enum MyEnum {
One,
Two,
}
// Rc<&T>
pub fn test1<T>(foo: &T) {}
pub fn test2(foo: &MyStruct) {}
pub fn test3(foo: &MyEnum) {}
pub fn test4_neg(foo: Rc<SubT<&usize>>) {}
// Rc<Rc<T>>
pub fn test5(a: Rc<bool>) {}
// Rc<Box<T>>
pub fn test6(a: Box<bool>) {}
// Box<&T>
pub fn test7<T>(foo: &T) {}
pub fn test8(foo: &MyStruct) {}
pub fn test9(foo: &MyEnum) {}
pub fn test10_neg(foo: Box<SubT<&usize>>) {}
fn main() {}