Near-One / near-plugins

Implementation of common patterns used for NEAR smart contracts.
Creative Commons Zero v1.0 Universal
27 stars 12 forks source link

Rust guidelines breaking examples #13

Closed joshuajbouw closed 1 year ago

joshuajbouw commented 1 year ago

There is an issue with the following lines of code as it breaks Rust code guidelines.

Should be owner (REF): https://github.com/aurora-is-near/near-plugins/blob/9d17246b0ae7c4446b46b5b75fb4d55bfe6e9392/near-plugins/src/ownable.rs#L25

Should be set_owner: https://github.com/aurora-is-near/near-plugins/blob/9d17246b0ae7c4446b46b5b75fb4d55bfe6e9392/near-plugins/src/ownable.rs#L34

Should be is_owner: https://github.com/aurora-is-near/near-plugins/blob/9d17246b0ae7c4446b46b5b75fb4d55bfe6e9392/near-plugins/src/ownable.rs#L37

mfornet commented 1 year ago

The main idea of the prefix owner_* is to avoid conflicts with the potential implementation of functions with the same name. As NEP-141 does with public methods, adding the prefix ft_*. We could update this prefix to something different. However, having them under the same prefix seems like a sensible approach to me.

Since these are public methods, rust guidelines have less priority for naming.

joshuajbouw commented 1 year ago

Ok, I agree with the context that it is a namespace for the methods to follow near conventions here. I do not like that too much, though, and I certainly wouldn't use that convention in typical Rust programming. I can not argue with what has already been defined.

Regardless I believe this issue important to open up anyways, as I would imagine I wouldn't be the only one which may have this question and we can refer to them here.