False positive for boxed local in default Trait method implementation #4804
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Output of
cargo clippy -V
:clippy 0.0.212 (3aea8603 2019-09-03)
Given the following code:
Clippy lint boxed local is triggered, advising us to remove the Box and have plain
self
in the argument list, like this:However, doing this makes the code fail compilation with the following error:
the size for values of type "Self" cannot be known at compilation time
,which is always the case for traits.
I've encountered this while implementing the state design pattern with dynamic dispatch. I wouldn't usually opt for dynamic dispatch, however the problem domain requires it.
Ideally this lint should check weather the implementation is a default trait method implementation before triggering.
The text was updated successfully, but these errors were encountered: