Fix bunch of warnings
This commit is contained in:
@@ -36,7 +36,7 @@ open class Extension {
|
||||
|
||||
/// Registers a template filter with the given name
|
||||
public func registerFilter(_ name: String, filter: @escaping (Any?, [Any?]) throws -> Any?) {
|
||||
filters[name] = .arguments({ value, args, _ in try filter(value, args) })
|
||||
filters[name] = .arguments { value, args, _ in try filter(value, args) }
|
||||
}
|
||||
|
||||
/// Registers a template filter with the given name
|
||||
|
||||
@@ -35,10 +35,8 @@ class BlockContext {
|
||||
|
||||
extension Collection {
|
||||
func any(_ closure: (Iterator.Element) -> Bool) -> Iterator.Element? {
|
||||
for element in self {
|
||||
if closure(element) {
|
||||
return element
|
||||
}
|
||||
for element in self where closure(element) {
|
||||
return element
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
public func until(_ tags: [String]) -> ((TokenParser, Token) -> Bool) {
|
||||
return { parser, token in
|
||||
return { _, token in
|
||||
if let name = token.components.first {
|
||||
for tag in tags where name == tag {
|
||||
return true
|
||||
|
||||
@@ -48,7 +48,8 @@ public struct Variable: Equatable, Resolvable {
|
||||
|
||||
/// Resolve the variable in the given context
|
||||
public func resolve(_ context: Context) throws -> Any? {
|
||||
if variable.count > 1 && ((variable.hasPrefix("'") && variable.hasSuffix("'")) || (variable.hasPrefix("\"") && variable.hasSuffix("\""))) {
|
||||
if variable.count > 1 &&
|
||||
((variable.hasPrefix("'") && variable.hasSuffix("'")) || (variable.hasPrefix("\"") && variable.hasSuffix("\""))) {
|
||||
// String literal
|
||||
return String(variable[variable.index(after: variable.startIndex) ..< variable.index(before: variable.endIndex)])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user