Skip to content

Commit b96aa46

Browse files
authored
[ty] Reduce size of member table (#19572)
1 parent cc97579 commit b96aa46

5 files changed

Lines changed: 722 additions & 134 deletions

File tree

crates/ruff_python_ast/src/name.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ impl Name {
3636
pub fn as_str(&self) -> &str {
3737
self.0.as_str()
3838
}
39+
40+
pub fn push_str(&mut self, s: &str) {
41+
self.0.push_str(s);
42+
}
3943
}
4044

4145
impl Debug for Name {
@@ -44,6 +48,13 @@ impl Debug for Name {
4448
}
4549
}
4650

51+
impl std::fmt::Write for Name {
52+
fn write_str(&mut self, s: &str) -> std::fmt::Result {
53+
self.0.push_str(s);
54+
Ok(())
55+
}
56+
}
57+
4758
impl AsRef<str> for Name {
4859
#[inline]
4960
fn as_ref(&self) -> &str {

crates/ty/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ fn run_check(args: CheckCommand) -> anyhow::Result<ExitStatus> {
156156
match std::env::var(EnvVars::TY_MEMORY_REPORT).as_deref() {
157157
Ok("short") => write!(stdout, "{}", db.salsa_memory_dump().display_short())?,
158158
Ok("mypy_primer") => write!(stdout, "{}", db.salsa_memory_dump().display_mypy_primer())?,
159-
Ok("full") => write!(stdout, "{}", db.salsa_memory_dump().display_full())?,
159+
Ok("full") => {
160+
write!(stdout, "{}", db.salsa_memory_dump().display_full())?;
161+
}
160162
Ok(other) => {
161163
tracing::warn!(
162164
"Unknown value for `TY_MEMORY_REPORT`: `{other}`. Valid values are `short`, `mypy_primer`, and `full`."

0 commit comments

Comments
 (0)