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
{{ message }}
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
The method takes contract_class: &ContractClass and then clone it.
I think it should be contract_class: ContractClass because it would spare one clone. The ContractClass should be taking ownership of the ContractClass. The current implem adds an unnecessary clone if the lib a caller has a ContractClass for which he doesn't want to keep ownership after the call to ClassInfo::new.
The only reason I see to have the current implem is to spare a clone (in the case the lib caller needs to clone, which we can't know for sure) and that the conditions are not met, making ClassInfo::new return an error.
Even given this, I don't think we should arbitrage in this direction. It looks like a bad design to take a ref and later clone. If you end up needing the value ownership, take it from the get-go
The text was updated successfully, but these errors were encountered:
gswirski
pushed a commit
to reilabs/blockifier
that referenced
this issue
Jun 26, 2024
The method takes
contract_class: &ContractClass
and thenclone
it.I think it should be
contract_class: ContractClass
because it would spare one clone. TheContractClass
should be taking ownership of theContractClass
. The current implem adds an unnecessaryclone
if the lib a caller has aContractClass
for which he doesn't want to keep ownership after the call toClassInfo::new
.The only reason I see to have the current implem is to spare a
clone
(in the case the lib caller needs to clone, which we can't know for sure) and that the conditions are not met, makingClassInfo::new
return an error.Even given this, I don't think we should arbitrage in this direction. It looks like a bad design to take a ref and later clone. If you end up needing the value ownership, take it from the get-go
The text was updated successfully, but these errors were encountered: