Skip to content

Remove explicit returns to simplify code #104

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
Apr 13, 2021

Conversation

jevonmao
Copy link
Contributor

Since Swift 5.1, SE-0255 evolved Swift to have the capability to implicitly return from functions.

I removed unnecessary explicit returns to improve code readability and simplicity.

@ldiqual
Copy link
Contributor

ldiqual commented Apr 12, 2021

I'm no longer very active in the swift world but whatever language we're working with, I think having return is more explicit and clearer than not having it. Ultimately it comes down to taste so I'll defer to @JannThomas and @SplittyDev, but what I'd like to push for is to add swiftlint to the repo and enforce one style or the other – so that there's no debate about it in future PRs.

@jevonmao
Copy link
Contributor Author

@ldiqual I understand your perspective. Ultimately is your's and the maintainer's call. I am not sure if SwiftLint supports this particular return scenario, but I agree, that adding SwiftLint is a good idea.

@SplittyDev
Copy link
Collaborator

SplittyDev commented Apr 12, 2021

I'm personally a fan of not having explicit return statements. In my opinion - since the return type is in the function signature and it's clear that the expression returns - there's no ambiguity there. Let's wait for @JannThomas and see what he prefers.

@JannThomas
Copy link
Collaborator

To be honest, I don't have a strong personal opinion on this, but this is where the Swift community is going and I think we should probably adopt it if only for that reason.

Copy link
Collaborator

@SplittyDev SplittyDev left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@JannThomas
Copy link
Collaborator

That said lets also add SwiftLint, I created Issue #107 for that and will work on it I the coming days.

@SplittyDev SplittyDev merged commit d055f1f into siteline:master Apr 13, 2021
@jevonmao jevonmao deleted the simplify-return-syntax branch April 13, 2021 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants