mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
force adopt let/else and the Swift 1.2 if/let extensions in the stdlib a bit, for dogfooding
and cleanup. I changes cases that had a non-trivial "then" body but a trivial else. Most of the cases in the stdlib have a trivial "then" clause, so I didn't change them. Swift SVN r27567
This commit is contained in:
@@ -68,17 +68,15 @@ extension SequenceType ${"" if preds else "where Self.Generator.Element : Compar
|
||||
% end
|
||||
) -> ${GElement}? {
|
||||
var g = generate()
|
||||
if var result? = g.next() {
|
||||
for e in GeneratorSequence(g) {
|
||||
var result? = g.next() else { return nil }
|
||||
for e in GeneratorSequence(g) {
|
||||
% if preds:
|
||||
if isOrderedBefore(e, result) { result = e }
|
||||
if isOrderedBefore(e, result) { result = e }
|
||||
% else:
|
||||
if e < result { result = e }
|
||||
if e < result { result = e }
|
||||
% end
|
||||
}
|
||||
return result
|
||||
}
|
||||
return nil
|
||||
return result
|
||||
}
|
||||
|
||||
/// Returns the maximum element in `self`.
|
||||
@@ -145,9 +143,6 @@ else:
|
||||
return false
|
||||
}
|
||||
}
|
||||
else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return otherGenerator.next() != nil ? false : true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user