1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 06:42:56 +08:00

Merge pull request #18958 from andy840119/remove-nullable-disable-in-the-extension

Remove nullable disable annotation in the extension namespace.
This commit is contained in:
Dan Balasescu 2022-07-01 13:52:12 +09:00 committed by GitHub
commit 42d56aa640
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 9 additions and 20 deletions

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System.Collections.Generic;
namespace osu.Game.Extensions

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using Humanizer;
using osu.Framework.Bindables;
using osu.Framework.Graphics;

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using System.Globalization;
using osu.Game.Localisation;

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using Humanizer;
using osu.Framework.Extensions.LocalisationExtensions;

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using System.Linq;
@ -23,7 +21,7 @@ namespace osu.Game.Extensions
/// </remarks>
internal static string GetInvariantInstantiationInfo(this Type type)
{
string assemblyQualifiedName = type.AssemblyQualifiedName;
string? assemblyQualifiedName = type.AssemblyQualifiedName;
if (assemblyQualifiedName == null)
throw new ArgumentException($"{type}'s assembly-qualified name is null. Ensure that it is a concrete type and not a generic type parameter.", nameof(type));

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System.Globalization;
using Newtonsoft.Json.Linq;
using osu.Framework.IO.Network;
@ -18,7 +16,7 @@ namespace osu.Game.Extensions
/// </summary>
public static void AddCursor(this WebRequest webRequest, Cursor cursor)
{
cursor?.Properties.ForEach(x =>
cursor.Properties.ForEach(x =>
{
webRequest.AddParameter("cursor[" + x.Key + "]", (x.Value as JValue)?.ToString(CultureInfo.InvariantCulture) ?? x.Value.ToString());
});

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Framework.IO.Network;
using osu.Game.Extensions;
@ -11,9 +9,9 @@ namespace osu.Game.Online.API.Requests
public class GetNewsRequest : APIRequest<GetNewsResponse>
{
private readonly int? year;
private readonly Cursor cursor;
private readonly Cursor? cursor;
public GetNewsRequest(int? year = null, Cursor cursor = null)
public GetNewsRequest(int? year = null, Cursor? cursor = null)
{
this.year = year;
this.cursor = cursor;
@ -22,7 +20,9 @@ namespace osu.Game.Online.API.Requests
protected override WebRequest CreateWebRequest()
{
var req = base.CreateWebRequest();
req.AddCursor(cursor);
if (cursor != null)
req.AddCursor(cursor);
if (year.HasValue)
req.AddParameter("year", year.Value.ToString());

View File

@ -112,7 +112,8 @@ namespace osu.Game.Online.API.Requests
req.AddParameter("nsfw", ExplicitContent == SearchExplicit.Show ? "true" : "false");
req.AddCursor(cursor);
if (cursor != null)
req.AddCursor(cursor);
return req;
}