Open sgued opened 3 weeks ago
This looks like it should be a compiler optimization tbh.
In the vast majority of cases the compiler is already able to optimize this. But optimization is not the main goal. The main goal is to make the code more concise and readable. One other aspect is to "teach" users that a dependency has added a From
implementation for their use-case and they don't have to work around it anymore.
What it does
This lints against using
from
twice using an itermediary type when there is anFrom
implementation in one stepAdvantage
Drawbacks
It might be possible that the 2 implementations do not have the same behaviour, but based on the documentation of
From
, this does not really fit the contract of the trait.Example
With the context:
Could be written as: