Closed
Description
Simplest case:
trait Trait {
fn f(self);
}
impl<T> Trait for Box<T> {
fn f(self) {}
}
warning: local variable doesn't need to be boxed here, #[warn(boxed_local)] on by default
--> src/main.rs:9:10
|
9 | fn f(self) {}
| ^^^^
More realistic case that we hit in dtolnay/syn#85:
trait LiftOnce<T, U> {
type Output;
fn lift<F>(self, f: F) -> Self::Output where F: FnOnce(T) -> U;
}
impl<T, U> LiftOnce<T, U> for Box<T> {
type Output = Box<U>;
fn lift<F>(self, f: F) -> Box<U> where F: FnOnce(T) -> U {
Box::new(f(*self))
}
}
I would consider this a false positive.