Add MustUseReturnValue to copy-over methods

This commit is contained in:
DrSmugleaf
2021-03-02 17:36:48 +01:00
parent 24ba7e0914
commit 173835efee
2 changed files with 6 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
using System;
using JetBrains.Annotations;
using Robust.Shared.Serialization.Manager.Result;
using Robust.Shared.Serialization.Markdown;
using Robust.Shared.Serialization.Markdown.Validation;
@@ -158,6 +159,7 @@ namespace Robust.Shared.Serialization.Manager
/// This object is not necessarily the same instance as the one passed
/// as <see cref="target"/>.
/// </returns>
[MustUseReturnValue]
object? Copy(object? source, object? target, ISerializationContext? context = null, bool skipHook = false);
/// <summary>
@@ -174,6 +176,7 @@ namespace Robust.Shared.Serialization.Manager
/// This object is not necessarily the same instance as the one passed
/// as <see cref="target"/>.
/// </returns>
[MustUseReturnValue]
T? Copy<T>(T? source, T? target, ISerializationContext? context = null, bool skipHook = false);
/// <summary>

View File

@@ -6,6 +6,7 @@ using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using JetBrains.Annotations;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Reflection;
@@ -520,11 +521,13 @@ namespace Robust.Shared.Serialization.Manager
return target;
}
[MustUseReturnValue]
public object? Copy(object? source, object? target, ISerializationContext? context = null, bool skipHook = false)
{
return CopyToTarget(source, target, context, skipHook);
}
[MustUseReturnValue]
public T? Copy<T>(T? source, T? target, ISerializationContext? context = null, bool skipHook = false)
{
var copy = CopyToTarget(source, target, context, skipHook);