Skip to content

[gardening] Use optional binding #1358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 12, 2017
Merged

Conversation

ikesyo
Copy link
Member

@ikesyo ikesyo commented Dec 7, 2017

No description provided.

@ikesyo
Copy link
Member Author

ikesyo commented Dec 7, 2017

@swift-ci Please test

@alblue
Copy link
Contributor

alblue commented Dec 7, 2017

These look good to me. What do you think @phausler ? Do we need to update similar things elsewhere e.g. in overlays?

let testFile = createTestFile("testFile_in.txt", _contents: messageData)
if testFile != nil {
let url = URL(fileURLWithPath: testFile!)
if let testFile = createTestFile("testFile_in.txt", _contents: messageData) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While these are all improvements, I think perhaps we could do better:

guard let testFile = createTestFile("testFile_in.txt", _contents: messageData)  else {
   XCTFail("Unable to create temp file")
   return
}
...

guard is great for reducing the indentation and putting failure code near the test.

@ikesyo
Copy link
Member Author

ikesyo commented Dec 7, 2017

Submitted swiftlang/swift#13314 for some overlays.

@phausler
Copy link
Contributor

phausler commented Dec 7, 2017

yea, we should keep the overlays and swift-corelibs-foundation in sync. the change looks reasonable to me (however I didnt really get a chance to go over it in detail but it seems rather mechanical and isomorphic)

@ikesyo
Copy link
Member Author

ikesyo commented Dec 7, 2017

@swift-ci test and merge

@ikesyo
Copy link
Member Author

ikesyo commented Dec 8, 2017

@swift-ci Please test and merge

1 similar comment
@ikesyo
Copy link
Member Author

ikesyo commented Dec 8, 2017

@swift-ci Please test and merge

@ikesyo
Copy link
Member Author

ikesyo commented Dec 8, 2017

@swift-ci test and merge

1 similar comment
@ianpartridge
Copy link
Contributor

@swift-ci test and merge

@swift-ci swift-ci merged commit fed31bc into swiftlang:master Dec 12, 2017
@ikesyo ikesyo deleted the optional-binding branch December 12, 2017 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants