Skip to content

Commit 2d3b562

Browse files
committed
warnings: Misc simple fixes
- Remove unused value and unnecessary unsafeBitCast - Fix expression implicitly coerced from 'Any?' to Any
1 parent 7223471 commit 2d3b562

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

CoreFoundation/Base.subproj/CFRuntime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,7 @@ static bool (*CAS32)(int32_t, int32_t, volatile int32_t *) = OSAtomicCompareAndS
12841284

12851285
#if DEPLOYMENT_RUNTIME_SWIFT
12861286
extern void swift_retain(void *);
1287+
extern void swift_release(void *);
12871288
#endif
12881289

12891290
// For "tryR==true", a return of NULL means "failed".
@@ -1399,7 +1400,6 @@ Boolean _CFIsDeallocating(CFTypeRef cf) {
13991400
static void _CFRelease(CFTypeRef CF_RELEASES_ARGUMENT cf) {
14001401
#if DEPLOYMENT_RUNTIME_SWIFT
14011402
// We always call through to swift_release, since all CFTypeRefs are at least _NSCFType objects
1402-
extern void swift_release(void *);
14031403
swift_release((void *)cf);
14041404
#else
14051405

Foundation/CharacterSet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ public struct CharacterSet : ReferenceConvertible, Equatable, Hashable, SetAlgeb
486486

487487
@_semantics("convertToObjectiveC")
488488
public func _bridgeToObjectiveC() -> NSCharacterSet {
489-
return unsafeBitCast(_wrapped, to: NSCharacterSet.self)
489+
return _wrapped
490490
}
491491

492492
public static func _forceBridgeFromObjectiveC(_ input: NSCharacterSet, result: inout CharacterSet?) {

Foundation/NSKeyedArchiver.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ open class NSKeyedArchiver : NSCoder {
376376
if objv == nil {
377377
return true // always have a null reference
378378
} else {
379-
return self._objRefMap[_SwiftValue.store(objv)] != nil
379+
return self._objRefMap[_SwiftValue.store(objv!)] != nil
380380
}
381381
}
382382

Foundation/NSKeyedUnarchiver.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ open class NSKeyedUnarchiver : NSCoder {
387387
}
388388

389389
// check replacement cache
390-
object = self._replacementMap[_SwiftValue.store(decodedObject)]
390+
object = self._replacementMap[_SwiftValue.store(decodedObject!)]
391391
if object != nil {
392392
return object
393393
}

Foundation/NSString.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ open class NSString : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSC
286286
internal var _fastContents: UnsafePointer<UniChar>? {
287287
if type(of: self) == NSString.self || type(of: self) == NSMutableString.self {
288288
if !_storage._core.isASCII {
289-
return unsafeBitCast(_storage._core.startUTF16, to: UnsafePointer<UniChar>.self)
289+
return UnsafePointer<UniChar>(_storage._core.startUTF16)
290290
}
291291
}
292292
return nil

TestFoundation/TestNSURLSession.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ extension DataTask : URLSessionDataDelegate {
428428

429429
extension DataTask : URLSessionTaskDelegate {
430430
public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
431-
guard let e = error as? URLError else { return }
431+
guard (error as? URLError) != nil else { return }
432432
dataTaskExpectation.fulfill()
433433
if let cancellation = cancelExpectation {
434434
cancellation.fulfill()

0 commit comments

Comments
 (0)