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

Task.FromResult should not be awaited for trivial operations. #1074

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions Snowflake.Data/Core/ArrowResultSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ internal override bool NextResult()
return false;
}

internal override async Task<bool> NextResultAsync(CancellationToken cancellationToken)
internal override Task<bool> NextResultAsync(CancellationToken cancellationToken)
{
return await Task.FromResult(false);
return Task.FromResult(false);
}

internal override bool HasRows()
Expand Down
2 changes: 1 addition & 1 deletion Snowflake.Data/Core/SFBlockingChunkDownloaderV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public async Task<BaseResultChunk> GetNextChunkAsync()
}
else
{
return await Task.FromResult<BaseResultChunk>(null);
return null;
}
}

Expand Down
4 changes: 2 additions & 2 deletions Snowflake.Data/Core/SFMultiStatementsResultSet.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2022 Snowflake Computing Inc. All rights reserved.
*/

Expand Down Expand Up @@ -72,7 +72,7 @@ internal override async Task<bool> NextResultAsync(CancellationToken cancellatio
}

updateResultMetadata();
return await Task.FromResult(curResultSet != null);
return curResultSet != null;
}

internal override bool NextResult()
Expand Down
6 changes: 3 additions & 3 deletions Snowflake.Data/Core/SFResultSet.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2012-2019 Snowflake Computing Inc. All rights reserved.
*/

Expand Down Expand Up @@ -157,9 +157,9 @@ internal override bool NextResult()
return false;
}

internal override async Task<bool> NextResultAsync(CancellationToken cancellationToken)
internal override Task<bool> NextResultAsync(CancellationToken cancellationToken)
{
return await Task.FromResult(false);
return Task.FromResult(false);
}

internal override bool HasRows()
Expand Down
Loading