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
Improve the readability and stability of code by making the following changes listed below:
Use constant and static data types for values directly used within the code.
For example:
In the code below, the 3.14 value is used directly. So we can move into a constant data type declaration (as shown in the code snippet below the previous one).
Use std::cell::OnceCell for declaring constant data types by constructing the value once before use. Similarly, std::sync::OnceLock for declaring mutable static data types by constructing the value once before use.
Rename functions, structs, enums, etc. according to the Rust convention.
Replace &Option<T> to Option<&T> to stabilize the function signatures to reduce introducing breaking changes to the Codebase.
For more information on how making this change can stabilize function signature. See:
The reasoning behind the following changes is to improve the readability and stability of code, which can drastically improve developer experience and avoid unintentional breaking changes.
Do you want to work on this issue?
None
Additional information
No response
The text was updated successfully, but these errors were encountered:
neon-mmd
changed the title
♻️ Idiomatic code for improving readability and stability
🧑💻 Idiomatic code for improving readability and stability
Feb 14, 2024
neon-mmd
changed the title
🧑💻 Idiomatic code for improving readability and stability
🧑💻 Clean code for improving readability and stability
Feb 14, 2024
What would you like to share?
Work Expected From The Issue
Improve the readability and stability of code by making the following changes listed below:
For example:
In the code below, the
3.14
value is used directly. So we can move into a constant data type declaration (as shown in the code snippet below the previous one).Use
std::cell::OnceCell
for declaring constant data types by constructing the value once before use. Similarly,std::sync::OnceLock
for declaring mutable static data types by constructing the value once before use.Rename functions, structs, enums, etc. according to the Rust convention.
Replace
&Option<T>
toOption<&T>
to stabilize the function signatures to reduce introducing breaking changes to the Codebase.For more information on how making this change can stabilize function signature. See:
https://piped.video/watch?v=6c7pZYP_iIE
Reasoning Behind The Proposed Changes
The reasoning behind the following changes is to improve the readability and stability of code, which can drastically improve developer
experience
and avoid unintentional breaking changes.Do you want to work on this issue?
None
Additional information
No response
The text was updated successfully, but these errors were encountered: