ExchangeRate::from reads as a From conversion #14
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
ExchangeRate::from(src/exchange.rs:126) is a getter for the field namedfrom, which is what C-GETTER asks for, and clippy'sshould_implement_traitdoes not fire because the signature takes
&selfand so cannot matchFrom::from.The problem is at the call site rather than the definition.
ExchangeRate::from(&rate)is legal path syntax and reads as a conversion, and the collision stops being
cosmetic the moment anyone writes
impl From<Currency> for ExchangeRate— whichis a natural thing to want given that
identityalready does exactly that job.The FX-standard
base()/quote()pair would sidestep it and is more preciseabout which side of the pair is which. Keeping
from/tois defensible on thecondition that this type never implements
From; worth deciding deliberatelyrather than by default.