Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
apply review suggestion
  • Loading branch information
librelois committed Nov 8, 2022
commit 84ec23a208ea74c68644a2c7bf599db7725f5bae
10 changes: 6 additions & 4 deletions primitives/session/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,13 @@ where
T::Api: SessionKeys<Block>,
{
if !seeds.is_empty() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it easier to:

if seeds.is_empty() {
  return Ok(())
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A question of style, after compilation it is strictly equivalent.

Copy link
Member

@davxy davxy Nov 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. But stylistically speaking maybe is better to early exit when the initial conditions are not met (just to avoid a dummy indentation over all the function body)

But this is only my opinion :-D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

let runtime_api = client.runtime_api();
return Ok(())
}

let runtime_api = client.runtime_api();

for seed in seeds {
runtime_api.generate_session_keys(at, Some(seed.as_bytes().to_vec()))?;
}
for seed in seeds {
runtime_api.generate_session_keys(at, Some(seed.as_bytes().to_vec()))?;
}

Ok(())
Expand Down