#![deny(clippy::borrowed_box)] #![allow(clippy::blacklisted_name)] #![allow(unused_variables)] #![allow(dead_code)] pub fn test1(foo: &mut Box) { println!("{:?}", foo) } pub fn test2() { let foo: &Box; } struct Test3<'a> { foo: &'a Box, } trait Test4 { fn test4(a: &Box); } impl<'a> Test4 for Test3<'a> { fn test4(a: &Box) { unimplemented!(); } } use std::any::Any; pub fn test5(foo: &mut Box) { println!("{:?}", foo) } pub fn test6() { let foo: &Box; } struct Test7<'a> { foo: &'a Box, } trait Test8 { fn test8(a: &Box); } impl<'a> Test8 for Test7<'a> { fn test8(a: &Box) { unimplemented!(); } } pub fn test9(foo: &mut Box) { let _ = foo; } pub fn test10() { let foo: &Box; } struct Test11<'a> { foo: &'a Box, } trait Test12 { fn test4(a: &Box); } impl<'a> Test12 for Test11<'a> { fn test4(a: &Box) { unimplemented!(); } } fn main() { test1(&mut Box::new(false)); test2(); test5(&mut (Box::new(false) as Box)); test6(); test9(&mut (Box::new(false) as Box)); test10(); }