Set capacity of the string passed to push_item_name
.
Other callsites already do this, but these two were missed. This avoids some allocations.
This commit is contained in:
parent
f2d863fa75
commit
d20b1a8f6b
2 changed files with 2 additions and 2 deletions
|
@ -331,7 +331,7 @@ impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
|||
llvm::LLVMRustDIBuilderCreateSubroutineType(DIB(self), fn_signature)
|
||||
};
|
||||
|
||||
let mut name = String::new();
|
||||
let mut name = String::with_capacity(64);
|
||||
type_names::push_item_name(tcx, def_id, false, &mut name);
|
||||
|
||||
// Find the enclosing function, in case this is a closure.
|
||||
|
|
|
@ -28,7 +28,7 @@ pub fn item_namespace<'ll>(cx: &CodegenCx<'ll, '_>, def_id: DefId) -> &'ll DISco
|
|||
.map(|parent| item_namespace(cx, DefId { krate: def_id.krate, index: parent }));
|
||||
|
||||
let namespace_name_string = {
|
||||
let mut output = String::new();
|
||||
let mut output = String::with_capacity(64);
|
||||
type_names::push_item_name(cx.tcx, def_id, false, &mut output);
|
||||
output
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue