diff --git a/.swift-version b/.swift-version new file mode 100644 index 0000000..b883184 --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +5.9 \ No newline at end of file diff --git a/.swiftformat b/.swiftformat index 24a794d..9857c7f 100644 --- a/.swiftformat +++ b/.swiftformat @@ -1,4 +1,3 @@ ---swiftversion 5.7 --exclude .build # rules diff --git a/Sources/ScreamURITemplate/Internal/ValueFormatting.swift b/Sources/ScreamURITemplate/Internal/ValueFormatting.swift index 3a6626e..3684f78 100644 --- a/Sources/ScreamURITemplate/Internal/ValueFormatting.swift +++ b/Sources/ScreamURITemplate/Internal/ValueFormatting.swift @@ -47,11 +47,10 @@ func percentEncode(string: String, withAllowedCharacters allowedCharacterSet: Ch extension StringProtocol { func formatForTemplateExpansion(variableSpec: VariableSpec, expansionConfiguration: ExpansionConfiguration) throws -> String { - let modifiedValue: String - if let prefixLength = variableSpec.prefixLength() { - modifiedValue = String(prefix(prefixLength)) + let modifiedValue = if let prefixLength = variableSpec.prefixLength() { + String(prefix(prefixLength)) } else { - modifiedValue = String(self) + String(self) } let encodedExpansion = try percentEncode(string: modifiedValue, withAllowedCharacters: expansionConfiguration.percentEncodingAllowedCharacterSet, allowPercentEncodedTriplets: expansionConfiguration.allowPercentEncodedTriplets) if expansionConfiguration.named {