@@ -556,27 +556,15 @@ impl Interest {
556556
557557 /// Returns the common interest between these two Interests.
558558 ///
559- /// The common interest is defined as the least restrictive, so if one
560- /// interest is `never` and the other is `always` the common interest is
561- /// `always`.
559+ /// If both interests are the same, this propagates that interest.
560+ /// Otherwise, if they differ, the result must always be
561+ /// `Interest::sometimes` --- if the two subscribers differ in opinion, we
562+ /// will have to ask the current subscriber what it thinks, no matter what.
562563 pub ( crate ) fn and ( self , rhs : Interest ) -> Self {
563- match ( rhs. 0 , self . 0 ) {
564- // If the added interest is `never()`, don't change anything —
565- // either a different subscriber added a higher interest, which we
566- // want to preserve, or the interest is 0 anyway (as it's
567- // initialized to 0).
568- ( InterestKind :: Never , _) => self ,
569- // If the interest is `sometimes()`, that overwrites a `never()`
570- // interest, but doesn't downgrade an `always()` interest.
571- ( InterestKind :: Sometimes , InterestKind :: Never ) => rhs,
572- // If both `Interests` are always, then the interest is `Always`.
573- ( InterestKind :: Always , InterestKind :: Always ) => rhs,
574- // If either interest is `Always`, but the other is *not*, then the
575- // result is always `Sometimes` --- we will have to ask the current
576- // subscriber, since whether or not the callsite is enabled depends
577- // which subscriber is active.
578- ( InterestKind :: Always , _) | ( _, InterestKind :: Always ) => Interest :: sometimes ( ) ,
579- _ => self ,
564+ if dbg ! ( self . 0 ) == dbg ! ( rhs. 0 ) {
565+ self
566+ } else {
567+ Interest :: sometimes ( )
580568 }
581569 }
582570}
0 commit comments