Skip to content

Commit

Permalink
improve some String.StartsWith() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
dawedawe committed Dec 6, 2023
1 parent 0c103cb commit 59c7c50
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/FSharp.Formatting.ApiDocs/GenerateModel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -816,10 +816,10 @@ type internal CrossReferenceResolver(root, collectionName, qualify, extensions)

if (not (System.String.IsNullOrEmpty xmlsig)) then
assert
(xmlsig.StartsWith("M:")
|| xmlsig.StartsWith("P:")
|| xmlsig.StartsWith("F:")
|| xmlsig.StartsWith("E:"))
(xmlsig.StartsWith("M:", StringComparison.Ordinal)
|| xmlsig.StartsWith("P:", StringComparison.Ordinal)
|| xmlsig.StartsWith("F:", StringComparison.Ordinal)
|| xmlsig.StartsWith("E:", StringComparison.Ordinal))

xmlDocNameToSymbol.[xmlsig] <- memb

Expand All @@ -830,7 +830,7 @@ type internal CrossReferenceResolver(root, collectionName, qualify, extensions)
let xmlsig = getXmlDocSigForType entity

if (not (System.String.IsNullOrEmpty xmlsig)) then
assert (xmlsig.StartsWith("T:"))
assert (xmlsig.StartsWith("T:", StringComparison.Ordinal))
xmlDocNameToSymbol.[xmlsig] <- entity

if (not (niceNameEntityLookup.ContainsKey(entity.LogicalName))) then
Expand Down Expand Up @@ -986,7 +986,7 @@ type internal CrossReferenceResolver(root, collectionName, qualify, extensions)
| Some nm -> Some(externalDocsLink false entity.DisplayName nm nm)

let resolveCrossReferenceForTypeByXmlSig (typeXmlSig: string) =
assert (typeXmlSig.StartsWith("T:"))
assert (typeXmlSig.StartsWith("T:", StringComparison.Ordinal))

match xmlDocNameToSymbol.TryGetValue(typeXmlSig) with
| true, (:? FSharpEntity as entity) ->
Expand Down Expand Up @@ -1025,10 +1025,10 @@ type internal CrossReferenceResolver(root, collectionName, qualify, extensions)

let tryResolveCrossReferenceForMemberByXmlSig (memberXmlSig: string) =
assert
(memberXmlSig.StartsWith("M:")
|| memberXmlSig.StartsWith("P:")
|| memberXmlSig.StartsWith("F:")
|| memberXmlSig.StartsWith("E:"))
(memberXmlSig.StartsWith("M:", StringComparison.Ordinal)
|| memberXmlSig.StartsWith("P:", StringComparison.Ordinal)
|| memberXmlSig.StartsWith("F:", StringComparison.Ordinal)
|| memberXmlSig.StartsWith("E:", StringComparison.Ordinal))

match xmlDocNameToSymbol.TryGetValue(memberXmlSig) with
| true, (:? FSharpMemberOrFunctionOrValue as memb) when memb.DeclaringEntity.IsSome -> memb |> mfvToCref |> Some
Expand Down

0 comments on commit 59c7c50

Please sign in to comment.