Skip to content

Commit

Permalink
Remove some unnecessary duplicated checks (#63341)
Browse files Browse the repository at this point in the history
* Remove unnecessary duplicate check in DeflateManagedStream ctor

* Remove duplicate null check in JsonSerializer.Deserialize

* Delete duplicate check in XmlSerializationWriterILGen.WriteQualifiedNameElement

* Delete duplicate rule check in XmlTreeGen.AutoGenerated
  • Loading branch information
stephentoub authored Jan 5, 2022
1 parent ad5ccec commit 60012a1
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 16 deletions.
4 changes: 0 additions & 4 deletions src/libraries/System.Data.Common/src/System/Data/xmlsaver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1700,14 +1700,10 @@ internal static bool AutoGenerated(ForeignKeyConstraint fk, bool checkRelation)
if (fk.ExtendedProperties.Count > 0)
return false;


if (fk.AcceptRejectRule != AcceptRejectRule.None)
return false;
if (fk.DeleteRule != Rule.Cascade)
return false;
if (fk.DeleteRule != Rule.Cascade)
return false;


if (fk.RelatedColumnsReference.Length != 1)
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ internal DeflateManagedStream(Stream stream, ZipArchiveEntry.CompressionMethodVa
throw new ArgumentNullException(nameof(stream));
if (!stream.CanRead)
throw new ArgumentException(SR.NotSupported_UnreadableStream, nameof(stream));
if (!stream.CanRead)
throw new ArgumentException(SR.NotSupported_UnreadableStream, nameof(stream));

Debug.Assert(method == ZipArchiveEntry.CompressionMethodValues.Deflate64);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@ private void WriteQualifiedNameElement(string name, string? ns, object? defaultV
argTypes.ToArray()
)!;
ilg.Call(XmlSerializationWriter_WriteXXX);

if (hasDefault)
{
throw Globals.NotSupported("XmlQualifiedName DefaultValue not supported. Fail in WriteValue()");
}
}

[RequiresUnreferencedCode("calls Load")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,6 @@ public static partial class JsonSerializer
throw new ArgumentNullException(nameof(returnType));
}

if (returnType == null)
{
throw new ArgumentNullException(nameof(returnType));
}

JsonTypeInfo jsonTypeInfo = GetTypeInfo(options, returnType);
return ReadFromSpan<object?>(json, jsonTypeInfo)!;
}
Expand Down

0 comments on commit 60012a1

Please sign in to comment.