You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a great tool to help accelerate my learning of the language.
Clippy seems to suggest that take_inner could be a const fn. However, when that change is made, the code does not compile: "destructors cannot be evaluated at compile-time".
I'm using the "late bounds" pattern for declaring a type parameter only in the "smart" constructor.
pub struct Wrapper<I> {
inner: I,
}
impl<I> Wrapper<I>
where
I: Debug
{
pub fn new(a: I) -> Self
// fn:: I -> Wrapper I
{
Wrapper { inner: a }
}
pub fn inspect(&self)
// fn:: Wrapper I -> ()
{
println!("{:?}", self.inner);
}
}
pub fn take_inner<I>(w: Wrapper<I>) -> I { // <<< lint suggestion here fails to compile
w.inner
}
The text was updated successfully, but these errors were encountered:
EdmundsEcho
changed the title
The clippy lint db does not include a separate entry for "unused type parameter"
"could be const_fn" False "positive" i.e., makes a recommendation that might not be true -
May 19, 2019
EdmundsEcho
changed the title
"could be const_fn" False "positive" i.e., makes a recommendation that might not be true -
"could be const_fn" False "positive" i.e., makes a recommendation that does not compile
May 19, 2019
This is a great tool to help accelerate my learning of the language.
Clippy seems to suggest that
take_inner
could be aconst fn
. However, when that change is made, the code does not compile: "destructors cannot be evaluated at compile-time".I'm using the "late bounds" pattern for declaring a type parameter only in the "smart" constructor.
The text was updated successfully, but these errors were encountered: