Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve for loop and remove unnecessary assignment #1894

Merged
merged 2 commits into from Jul 18, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -151,12 +151,10 @@ private async Task RefreshHardwareWalletListAsync()
else if (hwis.Any(x => x.Type == HardwareWalletType.Ledger && x.Ready))
This conversation was marked as resolved by yahiheb

This comment has been minimized.

Copy link
@molnard

molnard Jul 17, 2019

Collaborator

Can remove the else too. Easier to read.

This comment has been minimized.

Copy link
@yahiheb

yahiheb Jul 17, 2019

Author Collaborator

I agree.

{
LoadWalletViewModelHardware.SetWarningMessage("To have a smooth user experience consider turning off your Ledger screensaver.");
break;
}
else
{
break;
}

break;

//foreach (var hwi in hwis)
//{
// // https://github.com/zkSNACKs/WalletWasabi/issues/1344#issuecomment-484607454
@@ -1,4 +1,4 @@
//
//
// Options.cs
//
// Authors:
@@ -403,7 +403,7 @@ private static void ExtractToken(ref string input, out string rest)
continue;
}

for (int j = i; j < top; j++)
for (int j = i + 1; j < top; j++)
This conversation was marked as resolved by nopara73

This comment has been minimized.

Copy link
@benthecarman

benthecarman Jul 12, 2019

Collaborator

What is the point of this change?

This comment has been minimized.

Copy link
@yahiheb

yahiheb Jul 12, 2019

Author Collaborator

When we set j = i we will make an extra (unnecessary) iteration.
Meaning we will check if (char.IsWhiteSpace(input[j])) but we know already that it is false because we have already checked it here if (char.IsWhiteSpace(input[i])) and if this was true we would not even get to the for j loop.

{
if (char.IsWhiteSpace(input[j]))
{
@@ -104,11 +104,7 @@ public async Task BanUtxosAsync(int severity, DateTimeOffset timeOfBan, bool for
}

var isNoted = true;
if (forceNoted)
{
isNoted = true;
}
else
if (!forceNoted)
{
if (RoundConfig.DosNoteBeforeBan.Value)
{
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.