diff --git a/osu.Framework/Extensions/ObjectExtensions/ObjectExtensions.cs b/osu.Framework/Extensions/ObjectExtensions/ObjectExtensions.cs index 795abccfa0..3bf2f21cfa 100644 --- a/osu.Framework/Extensions/ObjectExtensions/ObjectExtensions.cs +++ b/osu.Framework/Extensions/ObjectExtensions/ObjectExtensions.cs @@ -19,11 +19,8 @@ public static class ObjectExtensions /// The nullable object. /// The type of the object. /// The non-nullable object corresponding to . - public static T AsNonNull(this T? obj) - where T : class - { - return obj!; - } + [return: NotNullIfNotNull("obj")] + public static T AsNonNull(this T? obj) => obj!; /// /// If the given object is null.