2021-06-02 00:41:52 -05:00
|
|
|
#![warn(clippy::all)]
|
|
|
|
#![allow(clippy::boxed_local, clippy::needless_pass_by_value)]
|
2022-06-08 14:08:37 -05:00
|
|
|
#![allow(clippy::disallowed_names, unused_variables, dead_code)]
|
2021-06-02 00:41:52 -05:00
|
|
|
#![allow(unused_imports)]
|
|
|
|
|
2022-03-27 07:41:09 -05:00
|
|
|
pub struct MyStruct;
|
2021-06-02 00:41:52 -05:00
|
|
|
|
|
|
|
pub struct SubT<T> {
|
|
|
|
foo: T,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub enum MyEnum {
|
|
|
|
One,
|
|
|
|
Two,
|
|
|
|
}
|
|
|
|
|
|
|
|
mod outer_box {
|
2023-07-03 12:42:48 -05:00
|
|
|
use crate::{MyEnum, MyStruct, SubT};
|
2021-06-02 00:41:52 -05:00
|
|
|
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 {
|
2023-07-03 12:42:48 -05:00
|
|
|
use crate::{MyEnum, MyStruct, SubT};
|
2021-06-02 00:41:52 -05:00
|
|
|
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 {
|
2023-07-03 12:42:48 -05:00
|
|
|
use crate::{MyEnum, MyStruct, SubT};
|
2021-06-02 00:41:52 -05:00
|
|
|
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() {}
|