mirror of
https://github.com/astral-sh/ruff.git
synced 2026-10-28 10:45:37 +08:00
[ty] Reuse tuple length accessors for size hints (#27366)
## Summary Reuse tuple length accessors for size hints.
This commit is contained in:
1 parent
81f97ec410
commit
0e24940bd1
1 file changed
+1
-4
@@ -58,10 +58,7 @@ impl TupleLength {
|
||||
/// Returns the minimum and maximum length of this tuple. (The maximum length will be `None`
|
||||
/// for a tuple with a variable-length portion.)
|
||||
pub(crate) fn size_hint(self) -> (usize, Option<usize>) {
|
||||
match self {
|
||||
TupleLength::Fixed(len) => (len, Some(len)),
|
||||
TupleLength::Variable(prefix, suffix) => (prefix + suffix, None),
|
||||
}
|
||||
(self.minimum(), self.maximum())
|
||||
}
|
||||
|
||||
/// Returns the minimum length of this tuple.
|
||||
|
||||
Reference in new issue
Block a user