Skip to content

Commit a9ace8f

Browse files
Apply suggestions from code review
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
1 parent e22a8ea commit a9ace8f

File tree

1 file changed

+7
-6
lines changed
  • crates/ty_python_semantic/src/types

1 file changed

+7
-6
lines changed

crates/ty_python_semantic/src/types/tuple.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -884,12 +884,13 @@ impl<'db> TupleSpec<'db> {
884884

885885
fn is_disjoint_from(&self, db: &'db dyn Db, other: &Self) -> bool {
886886
// Two tuples with an incompatible number of required elements must always be disjoint.
887-
if let ((minimum, _), (_, Some(maximum))) | ((_, Some(maximum)), (minimum, _)) =
888-
(self.size_hint(), other.size_hint())
889-
{
890-
if maximum < minimum {
891-
return true;
892-
}
887+
let (self_min, self_max) = self.size_hint();
888+
let (other_min, other_max) = other.size_hint();
889+
if self_max.is_some_and(|max|max < other_min) {
890+
return true;
891+
}
892+
if other_max.is_some_and(|max|max < self_min) {
893+
return true;
893894
}
894895

895896
// If any of the required elements are pairwise disjoint, the tuples are disjoint as well.

0 commit comments

Comments
 (0)