mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-18 12:46:59 +00:00
Because that's now the only crate that uses it. Moving stuff out of `rustc_middle` is always welcome. I chose to use `impl crate::MirPass`/`impl crate::MirLint` (with explicit `crate::`) everywhere because that's the only mention of `MirPass`/`MirLint` used in all of these files. (Prior to this change, `MirPass` was mostly imported via `use rustc_middle::mir::*` items.)
23 lines
384 B
Rust
23 lines
384 B
Rust
#[cfg(test)]
|
|
mod tests;
|
|
|
|
pub fn to_readable_str(mut val: usize) -> String {
|
|
let mut groups = vec![];
|
|
loop {
|
|
let group = val % 1000;
|
|
|
|
val /= 1000;
|
|
|
|
if val == 0 {
|
|
groups.push(group.to_string());
|
|
break;
|
|
} else {
|
|
groups.push(format!("{group:03}"));
|
|
}
|
|
}
|
|
|
|
groups.reverse();
|
|
|
|
groups.join("_")
|
|
}
|