Skip to content

[stdlib] rewrite optional handling using map #4552

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 1 commit into from
Sep 4, 2016
Merged

[stdlib] rewrite optional handling using map #4552

merged 1 commit into from
Sep 4, 2016

Conversation

Nirma
Copy link
Contributor

@Nirma Nirma commented Aug 30, 2016

I thought that rewriting the optional handling using map would make it a little bit
cleaner to read.

Hope its ok!

@Nirma
Copy link
Contributor Author

Nirma commented Sep 2, 2016

@gribozavr Is this kind of a change too much of a nitpick?
Sorry if it is. 🙇

return nil
}
return String(_storage: stringBuffer)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would actually be better as return stringBufferOptional.map { String(_storage: $0) }.

@Nirma Nirma changed the title [stdlib] rewrite using guard for readability [stdlib] rewrite optional handling using map Sep 2, 2016
@Nirma
Copy link
Contributor Author

Nirma commented Sep 2, 2016

@gribozavr Thanks! That is a lot cleaner, I updated the pull request.

How does it look now?

@gribozavr
Copy link
Contributor

LGTM, thanks!

@swift-ci Please smoke test

@gribozavr gribozavr merged commit 5aa005f into swiftlang:master Sep 4, 2016
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.

2 participants