[Offline] Fleming Testnet v6.1 Release - Node Support

I know I’m not quite in the right place to mention this, but I’m also not quite sure how to do otherwise … I was wondering if that was intended than in the code here: ( safe_network/sn_node.rs at ca873b32a96db39d6500380fb61df55f77d61d3e · maidsafe/safe_network · GitHub ) there is a “,” at the end and not a “;” ?

3 Likes

If I’m correct, “;” are being used at the end of a statement, “,” are being used for separating multiple statements.

In this case its separating the two possible outcomes, succes and error.

2 Likes

Would it be better to use it like this:

Ok(()) => {
        exit(0);
},

Rather than what is now:

Ok(()) => exit(0),

or it would just be incorrect ?

That’s not incorrect, but the two are analogous here.

ie, with Ok(()) => exit(0), , ; is not needed (and would break compilation I think), the return on Ok is exit(0).


As i understand the return of both is inconsequential as we exit so there is no return.

But if we were returning here

Ok(()) => {
        do_something();
},

has a return type of ()

whereas Ok(()) => do_something(0), would return the result of do_something.

6 Likes

The comma there is used to separate different patterns that are used to select the action from the result of the statement following the match.

FYI there’s a topic for stuff like this:

3 Likes