Hello, I noticed this while reading through. The names are not consistent.
Avoid loosely-scoped let mut
[...]
let my_structure = {
let mut my_structure = MyStructure{}
// Mutate `my_structure` as required to construct it.
my_structure
};
For greatest clarity, make sure the name of the outer (immutable) and inner (mutable) declarations have the same name, here my_structure`.
then
Shadowing
[...]
In the second case when shadowing in the same scope with the same type, there is no restriction placed on this and it may be done as many times as necessary.
However, if this is being used to effectively mutate a value during construction with no other values being affected, instead use the scoped-mutability pattern—
let thing = {
let mut my_thing = ...;
// Mutate `my_thing` to construct it...
my_thing
};
Hello, I noticed this while reading through. The names are not consistent.
then
Regards,