diff --git a/RxSwift/DataStructures/Bag.swift b/RxSwift/DataStructures/Bag.swift index 92605d4a..ddabf167 100644 --- a/RxSwift/DataStructures/Bag.swift +++ b/RxSwift/DataStructures/Bag.swift @@ -152,10 +152,7 @@ public struct Bag : CustomDebugStringConvertible { - returns: Number of elements in bag. */ public var count: Int { - var dictionaryCount = 0 - if let dc = _dictionary?.count { - dictionaryCount = dc - } + let dictionaryCount: Int = _dictionary?.count ?? 0 return _pairs.count + (_value0 != nil ? 1 : 0) + (_value1 != nil ? 1 : 0) + dictionaryCount }