Discard changes to crates/ty/src/main.rs

This commit is contained in:
Micha Reiser 2025-12-14 15:36:27 +01:00 committed by GitHub
parent 09dc969f14
commit c37776c6a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 26 deletions

View File

@ -1,11 +1,9 @@
mod allocator;
use colored::Colorize;
use std::io;
use ty::{ExitStatus, run};
pub fn main() -> ExitStatus {
let result = run().unwrap_or_else(|error| {
run().unwrap_or_else(|error| {
use io::Write;
// Use `writeln` instead of `eprintln` to avoid panicking when the stderr pipe is broken.
@ -31,27 +29,5 @@ pub fn main() -> ExitStatus {
}
ExitStatus::Error
});
// Print allocator memory usage if TY_ALLOCATOR_STATS is set
if std::env::var("TY_ALLOCATOR_STATS").is_ok() {
use io::Write;
let mut stderr = io::stderr().lock();
if let Some(stats) = allocator::memory_usage_stats() {
writeln!(stderr).ok();
writeln!(stderr, "{}", "Memory Usage Statistics:".bold()).ok();
write!(stderr, "{stats}").ok();
} else {
writeln!(stderr).ok();
writeln!(
stderr,
"Allocator: {} (no detailed stats available)",
allocator::allocator_name()
)
.ok();
}
}
result
})
}