Repository: ReactiveX/RxSwift
File: RxTest/Subscription.swift (Swift)

Code before:

    /// Creates a new subscription object with the given virtual subscription time.
    ///
    /// - parameter subscribe: Virtual time at which the subscription occurred.
    public init(_ subscribe: Int) {
        self.subscribe = subscribe
        self.unsubscribe = Int.max
    }

    
    /// Creates a new subscription object with the given virtual subscription and unsubscription time.
    ///
    /// - parameter subscribe: Virtual time at which the subscription occurred.
    /// - parameter unsubscribe: Virtual time at which the unsubscription occurred.
    public init(_ subscribe: Int, _ unsubscribe: Int) {
        self.subscribe = subscribe
        self.unsubscribe = unsubscribe
    }
}

extension Subscription
    : Hashable
    , Equatable {
    /// The hash value.
    #if !swift(>=4.2.2)
    public var hashValue : Int {
        return self.subscribe.hashValue ^ self.unsubscribe.hashValue
    }
    #else
    public func hash(into hasher: inout Hasher) {
        hasher.combine(self.subscribe)
        hasher.combine(self.unsubscribe)
    }
    #endif
}

extension Subscription
    : CustomDebugStringConvertible {
    /// A textual representation of `self`, suitable for debugging.
    public var debugDescription : String {
        let infiniteText = "Infinity"
        return "(\(self.subscribe): \(self.unsubscribe != Int.max ? String(self.unsubscribe) : infiniteText))"
    }
}

public func == (lhs: Subscription, rhs: Subscription) -> Bool {
    return lhs.subscribe == rhs.subscribe && lhs.unsubscribe == rhs.unsubscribe
}


Review comment (suggestion):
```suggestion
    public var hashValue: Int {
```

nitpick

Code after:

    /// Creates a new subscription object with the given virtual subscription time.
    ///
    /// - parameter subscribe: Virtual time at which the subscription occurred.
    public init(_ subscribe: Int) {
        self.subscribe = subscribe
        self.unsubscribe = Int.max
    }

    
    /// Creates a new subscription object with the given virtual subscription and unsubscription time.
    ///
    /// - parameter subscribe: Virtual time at which the subscription occurred.
    /// - parameter unsubscribe: Virtual time at which the unsubscription occurred.
    public init(_ subscribe: Int, _ unsubscribe: Int) {
        self.subscribe = subscribe
        self.unsubscribe = unsubscribe
    }
}

extension Subscription
    : Hashable
    , Equatable {
    /// The hash value.
    #if !swift(>=4.2.2)
    public var hashValue: Int {
        return self.subscribe.hashValue ^ self.unsubscribe.hashValue
    }
    #else
    public func hash(into hasher: inout Hasher) {
        hasher.combine(self.subscribe)
        hasher.combine(self.unsubscribe)
    }
    #endif
}

extension Subscription
    : CustomDebugStringConvertible {
    /// A textual representation of `self`, suitable for debugging.
    public var debugDescription : String {
        let infiniteText = "Infinity"
        return "(\(self.subscribe): \(self.unsubscribe != Int.max ? String(self.unsubscribe) : infiniteText))"
    }
}

public func == (lhs: Subscription, rhs: Subscription) -> Bool {
    return lhs.subscribe == rhs.subscribe && lhs.unsubscribe == rhs.unsubscribe
}