Closed karim-en closed 1 year ago
It is possible to reduce the compiled code size a little bit if we follow those rules.
Examples:
Don’t use .expect() here. Instead, use unwrap_or_else https://github.com/aurora-is-near/near-plugins/blob/d822c2f051ccdc03b50f206650524daf43ae7526/near-plugins-derive/src/access_controllable.rs#L92
.expect()
unwrap_or_else
Avoid Rust standard assertions and panic macro and use near_sdk::require instead https://github.com/aurora-is-near/near-plugins/blob/d822c2f051ccdc03b50f206650524daf43ae7526/near-plugins-derive/src/access_controllable.rs#L123 https://github.com/aurora-is-near/near-plugins/blob/d822c2f051ccdc03b50f206650524daf43ae7526/near-plugins-derive/src/ownable.rs#L43
near_sdk::require
It is possible to reduce the compiled code size a little bit if we follow those rules.
Examples:
Don’t use
.expect()
here. Instead, useunwrap_or_else
https://github.com/aurora-is-near/near-plugins/blob/d822c2f051ccdc03b50f206650524daf43ae7526/near-plugins-derive/src/access_controllable.rs#L92Avoid Rust standard assertions and panic macro and use
near_sdk::require
instead https://github.com/aurora-is-near/near-plugins/blob/d822c2f051ccdc03b50f206650524daf43ae7526/near-plugins-derive/src/access_controllable.rs#L123 https://github.com/aurora-is-near/near-plugins/blob/d822c2f051ccdc03b50f206650524daf43ae7526/near-plugins-derive/src/ownable.rs#L43