Skip to content
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

Use guard let instead of nil checking #161

Closed
wants to merge 0 commits into from

Conversation

frootloops
Copy link
Contributor

No description provided.

@@ -231,7 +231,8 @@ public struct _StringBuffer {
}

var _anyObject: AnyObject? {
return _storage.storage != nil ? .Some(_storage.storage!) : .None
guard let storage = _storage.storage else { return .None }
return .Some(storage)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just

   var _anyObject: AnyObject? {
    return _storage.storage
   }

?

@gribozavr
Copy link
Contributor

Please try with the even simpler code, and don't forget to run tests (utils/build-script -RT).

@frootloops
Copy link
Contributor Author

@lgerbarg thanks! I have tried to run tests but I got an error.

Exit Code: 1
Command Output (stderr):
--
/Users/arsen/code/apple/swift/test/Driver/Dependencies/bindings-build-record.swift:17:13: error: expected string not found in input
// NO-EXEC: inputs: ["./main.swift"], output: {{[{].*[}]}}, condition: check-dependencies
            ^
<stdin>:1:1: note: scanning from here
# "x86_64-apple-macosx10.9" - "swift", inputs: ["./main.swift"], output: {object: "./main.o", swift-dependencies: "./main.swiftdeps"}, condition: run-without-cascading
^
<stdin>:1:34: note: possible intended match here
# "x86_64-apple-macosx10.9" - "swift", inputs: ["./main.swift"], output: {object: "./main.o", swift-dependencies: "./main.swiftdeps"}, condition: run-without-cascading
                                 ^

--

********************
Testing Time: 768.08s
********************
Failing Tests (1):
    Swift :: Driver/Dependencies/bindings-build-record.swift

  Expected Passes    : 7247
  Expected Failures  : 8
  Unsupported Tests  : 33
  Unexpected Failures: 1
*** Failed while running tests for swift (check-swift-all-macosx-x86_64)
utils/build-script: command terminated with a non-zero exit status 1, aborting

@frootloops frootloops closed this Dec 5, 2015
slavapestov pushed a commit to slavapestov/swift that referenced this pull request Nov 27, 2018
Disable dispatch_cascade due to hang in Swift CI
dabelknap pushed a commit to dabelknap/swift that referenced this pull request Dec 5, 2018
maldahleh pushed a commit to maldahleh/swift that referenced this pull request Oct 26, 2020
freak4pc pushed a commit to freak4pc/swift that referenced this pull request Sep 28, 2022
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