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:
Chris Lattner
2015-04-22 06:24:06 +00:00
parent 935e95080c
commit 3ec09eec8e
11 changed files with 82 additions and 107 deletions

View File

@@ -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
}