mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:16 +00:00
[ty] Remove Specialization::display
(full) (#19682)
## Summary This seems to be unused
This commit is contained in:
parent
d43e6fb9c6
commit
ade6a4262a
1 changed files with 9 additions and 37 deletions
|
@ -436,21 +436,6 @@ impl Display for DisplayGenericContext<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'db> Specialization<'db> {
|
impl<'db> Specialization<'db> {
|
||||||
/// Renders the specialization in full, e.g. `{T = int, U = str}`.
|
|
||||||
pub fn display(
|
|
||||||
&'db self,
|
|
||||||
db: &'db dyn Db,
|
|
||||||
tuple_specialization: TupleSpecialization,
|
|
||||||
) -> DisplaySpecialization<'db> {
|
|
||||||
DisplaySpecialization {
|
|
||||||
typevars: self.generic_context(db).variables(db),
|
|
||||||
types: self.types(db),
|
|
||||||
db,
|
|
||||||
full: true,
|
|
||||||
tuple_specialization,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Renders the specialization as it would appear in a subscript expression, e.g. `[int, str]`.
|
/// Renders the specialization as it would appear in a subscript expression, e.g. `[int, str]`.
|
||||||
pub fn display_short(
|
pub fn display_short(
|
||||||
&'db self,
|
&'db self,
|
||||||
|
@ -461,7 +446,6 @@ impl<'db> Specialization<'db> {
|
||||||
typevars: self.generic_context(db).variables(db),
|
typevars: self.generic_context(db).variables(db),
|
||||||
types: self.types(db),
|
types: self.types(db),
|
||||||
db,
|
db,
|
||||||
full: false,
|
|
||||||
tuple_specialization,
|
tuple_specialization,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -471,34 +455,22 @@ pub struct DisplaySpecialization<'db> {
|
||||||
typevars: &'db FxOrderSet<TypeVarInstance<'db>>,
|
typevars: &'db FxOrderSet<TypeVarInstance<'db>>,
|
||||||
types: &'db [Type<'db>],
|
types: &'db [Type<'db>],
|
||||||
db: &'db dyn Db,
|
db: &'db dyn Db,
|
||||||
full: bool,
|
|
||||||
tuple_specialization: TupleSpecialization,
|
tuple_specialization: TupleSpecialization,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for DisplaySpecialization<'_> {
|
impl Display for DisplaySpecialization<'_> {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||||
if self.full {
|
f.write_char('[')?;
|
||||||
f.write_char('{')?;
|
for (idx, (_, ty)) in self.typevars.iter().zip(self.types).enumerate() {
|
||||||
for (idx, (var, ty)) in self.typevars.iter().zip(self.types).enumerate() {
|
if idx > 0 {
|
||||||
if idx > 0 {
|
f.write_str(", ")?;
|
||||||
f.write_str(", ")?;
|
|
||||||
}
|
|
||||||
write!(f, "{} = {}", var.name(self.db), ty.display(self.db))?;
|
|
||||||
}
|
}
|
||||||
f.write_char('}')
|
ty.display(self.db).fmt(f)?;
|
||||||
} else {
|
|
||||||
f.write_char('[')?;
|
|
||||||
for (idx, (_, ty)) in self.typevars.iter().zip(self.types).enumerate() {
|
|
||||||
if idx > 0 {
|
|
||||||
f.write_str(", ")?;
|
|
||||||
}
|
|
||||||
ty.display(self.db).fmt(f)?;
|
|
||||||
}
|
|
||||||
if self.tuple_specialization.is_yes() {
|
|
||||||
f.write_str(", ...")?;
|
|
||||||
}
|
|
||||||
f.write_char(']')
|
|
||||||
}
|
}
|
||||||
|
if self.tuple_specialization.is_yes() {
|
||||||
|
f.write_str(", ...")?;
|
||||||
|
}
|
||||||
|
f.write_char(']')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue