Skip to content

Commit ad3fad2

Browse files
committed
rename error
1 parent 6e2f987 commit ad3fad2

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

crates/ty_python_semantic/src/types/tuple.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -297,18 +297,18 @@ impl<'db> FixedLengthTuple<Type<'db>> {
297297
&self,
298298
db: &'db dyn Db,
299299
new_length: TupleLength,
300-
) -> Result<Tuple<Type<'db>>, TupleUnpackerError> {
300+
) -> Result<Tuple<Type<'db>>, ResizeTupleError> {
301301
match new_length {
302302
TupleLength::Fixed(new_length) => match self.len().cmp(&new_length) {
303-
Ordering::Less => Err(TupleUnpackerError::TooFewValues),
304-
Ordering::Greater => Err(TupleUnpackerError::TooManyValues),
303+
Ordering::Less => Err(ResizeTupleError::TooFewValues),
304+
Ordering::Greater => Err(ResizeTupleError::TooManyValues),
305305
Ordering::Equal => Ok(Tuple::Fixed(self.clone())),
306306
},
307307

308308
TupleLength::Variable(prefix, suffix) => {
309309
// The number of rhs values that will be consumed by the starred target.
310310
let Some(variable) = self.len().checked_sub(prefix + suffix) else {
311-
return Err(TupleUnpackerError::TooFewValues);
311+
return Err(ResizeTupleError::TooFewValues);
312312
};
313313

314314
// Extract rhs values into the prefix, then into the starred target, then into the
@@ -600,13 +600,13 @@ impl<'db> VariableLengthTuple<Type<'db>> {
600600
&self,
601601
db: &'db dyn Db,
602602
new_length: TupleLength,
603-
) -> Result<Tuple<Type<'db>>, TupleUnpackerError> {
603+
) -> Result<Tuple<Type<'db>>, ResizeTupleError> {
604604
match new_length {
605605
TupleLength::Fixed(new_length) => {
606606
// The number of elements that will get their value from our variable-length
607607
// portion.
608608
let Some(variable_count) = new_length.checked_sub(self.len().minimum()) else {
609-
return Err(TupleUnpackerError::TooManyValues);
609+
return Err(ResizeTupleError::TooManyValues);
610610
};
611611
Ok(Tuple::Fixed(FixedLengthTuple::from_elements(
612612
(self.prefix_elements().copied())
@@ -970,7 +970,7 @@ impl<'db> Tuple<Type<'db>> {
970970
&self,
971971
db: &'db dyn Db,
972972
new_length: TupleLength,
973-
) -> Result<Self, TupleUnpackerError> {
973+
) -> Result<Self, ResizeTupleError> {
974974
match self {
975975
Tuple::Fixed(tuple) => tuple.resize(db, new_length),
976976
Tuple::Variable(tuple) => tuple.resize(db, new_length),
@@ -1194,7 +1194,7 @@ impl<'db> TupleUnpacker<'db> {
11941194
pub(crate) fn unpack_tuple(
11951195
&mut self,
11961196
values: &Tuple<Type<'db>>,
1197-
) -> Result<(), TupleUnpackerError> {
1197+
) -> Result<(), ResizeTupleError> {
11981198
let values = values.resize(self.db, self.targets.len())?;
11991199
match (&mut self.targets, &values) {
12001200
(Tuple::Fixed(targets), Tuple::Fixed(values)) => {
@@ -1252,7 +1252,7 @@ impl<'db> VariableLengthTuple<UnionBuilder<'db>> {
12521252
}
12531253

12541254
#[derive(Clone, Debug, Eq, PartialEq)]
1255-
pub(crate) enum TupleUnpackerError {
1255+
pub(crate) enum ResizeTupleError {
12561256
TooFewValues,
12571257
TooManyValues,
12581258
}

crates/ty_python_semantic/src/types/unpacker.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use ruff_python_ast::{self as ast, AnyNodeRef};
88
use crate::Db;
99
use crate::semantic_index::ast_ids::{HasScopedExpressionId, ScopedExpressionId};
1010
use crate::semantic_index::place::ScopeId;
11-
use crate::types::tuple::{Tuple, TupleLength, TupleUnpacker, TupleUnpackerError};
11+
use crate::types::tuple::{ResizeTupleError, Tuple, TupleLength, TupleUnpacker};
1212
use crate::types::{Type, TypeCheckDiagnostics, infer_expression_types};
1313
use crate::unpack::{UnpackKind, UnpackValue};
1414

@@ -159,7 +159,7 @@ impl<'db, 'ast> Unpacker<'db, 'ast> {
159159
if let Some(builder) = self.context.report_lint(&INVALID_ASSIGNMENT, target)
160160
{
161161
match err {
162-
TupleUnpackerError::TooManyValues => {
162+
ResizeTupleError::TooManyValues => {
163163
let mut diag =
164164
builder.into_diagnostic("Too many values to unpack");
165165
diag.set_primary_message(format_args!(
@@ -170,7 +170,7 @@ impl<'db, 'ast> Unpacker<'db, 'ast> {
170170
format_args!("Got {}", tuple.len().display_minimum()),
171171
));
172172
}
173-
TupleUnpackerError::TooFewValues => {
173+
ResizeTupleError::TooFewValues => {
174174
let mut diag =
175175
builder.into_diagnostic("Not enough values to unpack");
176176
diag.set_primary_message(format_args!(

0 commit comments

Comments
 (0)