Skip to content

Commit 6509740

Browse files
stepanchegfacebook-github-bot
authored andcommitted
String constants
Summary: Constants are needed in the following diff D38518064. Reviewed By: bobyangyf Differential Revision: D38518062 fbshipit-source-id: 0eadab49c34c5a83c9c9bbdcb3eff004c97afd03
1 parent 5507160 commit 6509740

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

starlark/src/values/layout/heap/profile/aggregated.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,19 @@ impl Debug for AggregateHeapProfileInfo {
251251
}
252252

253253
impl AggregateHeapProfileInfo {
254+
const TOTALS_STR: &'static str = "TOTALS";
255+
const ROOT_STR: &'static str = "(root)";
256+
const BLANK_STR: &'static str = "";
257+
254258
pub(crate) fn collect(heap: &Heap, retained: Option<HeapKind>) -> AggregateHeapProfileInfo {
255259
let mut collector = StackCollector::new(retained);
256260
unsafe {
257261
heap.visit_arena(HeapKind::Unfrozen, &mut collector);
258262
}
259263
assert_eq!(1, collector.current.len());
260-
let totals_id = collector.ids.strings.index("TOTALS");
261-
let root_id = collector.ids.strings.index("(root)");
262-
let blank_id = collector.ids.strings.index("");
264+
let totals_id = collector.ids.strings.index(Self::TOTALS_STR);
265+
let root_id = collector.ids.strings.index(Self::ROOT_STR);
266+
let blank_id = collector.ids.strings.index(Self::BLANK_STR);
263267
AggregateHeapProfileInfo {
264268
strings: collector.ids.strings,
265269
root: collector.current.pop().unwrap().build(),

0 commit comments

Comments
 (0)