Remove pragma warning disable 1998
Function doesn't need async
This commit is contained in:
parent
cdea6fd3fb
commit
cacd16fa85
|
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Razor.Internal
|
||||||
|
{
|
||||||
|
public static class TaskCache
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="Task"/> that's already completed successfully.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// We're caching this in a static readonly field to make it more inlinable and avoid the volatile lookup done
|
||||||
|
/// by <c>Task.CompletedTask</c>.
|
||||||
|
/// </remarks>
|
||||||
|
#if NET451
|
||||||
|
public static readonly Task CompletedTask = Task.FromResult(0);
|
||||||
|
#else
|
||||||
|
public static readonly Task CompletedTask = Task.CompletedTask;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Text.Encodings.Web;
|
using System.Text.Encodings.Web;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Razor.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers
|
namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers
|
||||||
|
|
@ -31,7 +32,7 @@ namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers
|
||||||
tagMode,
|
tagMode,
|
||||||
items: new Dictionary<object, object>(),
|
items: new Dictionary<object, object>(),
|
||||||
uniqueId: string.Empty,
|
uniqueId: string.Empty,
|
||||||
executeChildContentAsync: async () => await Task.FromResult(result: true),
|
executeChildContentAsync: () => TaskCache.CompletedTask,
|
||||||
startTagHelperWritingScope: _ => { },
|
startTagHelperWritingScope: _ => { },
|
||||||
endTagHelperWritingScope: () => new DefaultTagHelperContent())
|
endTagHelperWritingScope: () => new DefaultTagHelperContent())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Razor.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.TagHelpers
|
namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
{
|
{
|
||||||
|
|
@ -37,11 +38,10 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <param name="output">A stateful HTML element used to generate an HTML tag.</param>
|
/// <param name="output">A stateful HTML element used to generate an HTML tag.</param>
|
||||||
/// <returns>A <see cref="Task"/> that on completion updates the <paramref name="output"/>.</returns>
|
/// <returns>A <see cref="Task"/> that on completion updates the <paramref name="output"/>.</returns>
|
||||||
/// <remarks>By default this calls into <see cref="Process"/>.</remarks>.
|
/// <remarks>By default this calls into <see cref="Process"/>.</remarks>.
|
||||||
#pragma warning disable 1998
|
public virtual Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
|
||||||
public virtual async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
|
|
||||||
{
|
{
|
||||||
Process(context, output);
|
Process(context, output);
|
||||||
|
return TaskCache.CompletedTask;
|
||||||
}
|
}
|
||||||
#pragma warning restore 1998
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue