Open stepancheg opened 6 months ago
I think this is a standard way to add functionality to a trait: eg. StreamExt, FutureExt. We also have a where
clause so it's not implemented for all types, only T: Point
.
This is bad for every similar extension, but for PointExt
it is especially inconvenient because of commonly used name new
.
If you think this is bad idea, close the issue, I can live with it.
Why is it completing this function for non Point types though? That seems to be a bug iiuc.
I think this is a standard way to add functionality to a trait: eg. StreamExt, FutureExt. We also have a
where
clause so it's not implemented for all types, onlyT: Point
.
It is standard to extend traits from foreign crates. But in this case Point
and PointExt
are both defined in the same module, so indeed we could just move all methods defined by PointExt
into Point
and drop the trait entirely.
I think this would primarily change that PointExt
and the methods it defines are currently not part of the public API and I don't know if we want to commit to them.
Why is it completing this function for non Point types though? That seems to be a bug iiuc.
That said, I also think this is a bug since not only is this bound to T: Point
, it is not even part of our public API.
JetBrains IDE is trying it's best to complete code, and unfortunately completes
::new
for every object, because there'seven for types which actually don't implement
Point
.We live in imperfect world, and it would be easier if rstar moved
::new
toPoint
fromPointExt
. Or just hid it from public API. Perhaps#[doc(hidden)]
.