E0053#
Warning name: unused_trait_bound
Unused trait bound.
The polymorphic function or method has a trait bound that is not used. This could be a potential bug that you have forgotten to apply the methods from the trait.
Erroneous example#
///|
trait Any {}
///|
pub fn[T : Any] check(_ : T) -> Unit {
println("Hello")
}
///|
pub fn[T : Compare] shortlex(a : Array[T], b : Array[T]) -> Int {
Int::compare(a.length(), b.length())
}
Suggestion#
There are multiple ways to fix this warning:
If this trait bound is unnecessary, you can remove it
You can cast the variable to a trait object
You can use the methods defined in the Trait