Skip to content

Commit fc43120

Browse files
committed
elide some asyncs
1 parent 7857663 commit fc43120

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/Microsoft.OpenApi.Hidi/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ namespace Microsoft.OpenApi.Hidi
1212
{
1313
static class Program
1414
{
15-
static async Task<int> Main(string[] args)
15+
static Task<int> Main(string[] args)
1616
{
1717
var rootCommand = CreateRootCommand();
1818

1919
// Parse the incoming args and invoke the handler
20-
return await rootCommand.InvokeAsync(args).ConfigureAwait(false);
20+
return rootCommand.InvokeAsync(args);
2121
}
2222

2323
internal static RootCommand CreateRootCommand()

src/Microsoft.OpenApi.Readers/OpenApiYamlDocumentReader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,15 @@ public async Task<ReadResult> ReadAsync(YamlDocument input, CancellationToken ca
140140
};
141141
}
142142

143-
private async Task<OpenApiDiagnostic> LoadExternalRefs(OpenApiDocument document, CancellationToken cancellationToken)
143+
private Task<OpenApiDiagnostic> LoadExternalRefs(OpenApiDocument document, CancellationToken cancellationToken)
144144
{
145145
// Create workspace for all documents to live in.
146146
var openApiWorkSpace = new OpenApiWorkspace();
147147

148148
// Load this root document into the workspace
149149
var streamLoader = new DefaultStreamLoader(_settings.BaseUrl);
150150
var workspaceLoader = new OpenApiWorkspaceLoader(openApiWorkSpace, _settings.CustomExternalLoader ?? streamLoader, _settings);
151-
return await workspaceLoader.LoadAsync(new OpenApiReference() { ExternalResource = "/" }, document, cancellationToken);
151+
return workspaceLoader.LoadAsync(new OpenApiReference() { ExternalResource = "/" }, document, cancellationToken);
152152
}
153153

154154
private void ResolveReferences(OpenApiDiagnostic diagnostic, OpenApiDocument document)

test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -177,25 +177,25 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiag
177177
}
178178

179179
[Fact]
180-
public async Task ThrowIfOpenApiUrlIsNotProvidedWhenValidating()
180+
public Task ThrowIfOpenApiUrlIsNotProvidedWhenValidating()
181181
{
182-
await Assert.ThrowsAsync<ArgumentNullException>(async () =>
183-
await OpenApiService.ValidateOpenApiDocument("", _logger, new CancellationToken()));
182+
return Assert.ThrowsAsync<ArgumentNullException>(() =>
183+
OpenApiService.ValidateOpenApiDocument("", _logger, new CancellationToken()));
184184
}
185185

186186

187187
[Fact]
188-
public async Task ThrowIfURLIsNotResolvableWhenValidating()
188+
public Task ThrowIfURLIsNotResolvableWhenValidating()
189189
{
190-
await Assert.ThrowsAsync<InvalidOperationException>(async () =>
191-
await OpenApiService.ValidateOpenApiDocument("https://example.org/itdoesnmatter", _logger, new CancellationToken()));
190+
return Assert.ThrowsAsync<InvalidOperationException>(() =>
191+
OpenApiService.ValidateOpenApiDocument("https://example.org/itdoesnmatter", _logger, new CancellationToken()));
192192
}
193193

194194
[Fact]
195-
public async Task ThrowIfFileDoesNotExistWhenValidating()
195+
public Task ThrowIfFileDoesNotExistWhenValidating()
196196
{
197-
await Assert.ThrowsAsync<InvalidOperationException>(async () =>
198-
await OpenApiService.ValidateOpenApiDocument("aFileThatBetterNotExist.fake", _logger, new CancellationToken()));
197+
return Assert.ThrowsAsync<InvalidOperationException>(() =>
198+
OpenApiService.ValidateOpenApiDocument("aFileThatBetterNotExist.fake", _logger, new CancellationToken()));
199199
}
200200

201201
[Fact]
@@ -285,7 +285,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchF
285285
}
286286

287287
[Fact]
288-
public async Task ThrowTransformCommandIfOpenApiAndCsdlAreEmpty()
288+
public Task ThrowTransformCommandIfOpenApiAndCsdlAreEmpty()
289289
{
290290
HidiOptions options = new HidiOptions
291291
{
@@ -294,8 +294,8 @@ public async Task ThrowTransformCommandIfOpenApiAndCsdlAreEmpty()
294294
InlineLocal = false,
295295
InlineExternal = false,
296296
};
297-
await Assert.ThrowsAsync<ArgumentException>(async () =>
298-
await OpenApiService.TransformOpenApiDocument(options, _logger, new CancellationToken()));
297+
return Assert.ThrowsAsync<ArgumentException>(() =>
298+
OpenApiService.TransformOpenApiDocument(options, _logger, new CancellationToken()));
299299

300300
}
301301

0 commit comments

Comments
 (0)