From 6596e7cddfc00281362c3640781f6cd6bc0b5614 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 28 Mar 2020 11:08:19 +0100 Subject: Nice string formatting --- crates/ra_hir_def/src/nameres.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_def/src') diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs index 40bdc34f5..f279c2ad4 100644 --- a/crates/ra_hir_def/src/nameres.rs +++ b/crates/ra_hir_def/src/nameres.rs @@ -63,6 +63,7 @@ use ra_db::{CrateId, Edition, FileId}; use ra_prof::profile; use ra_syntax::ast; use rustc_hash::FxHashMap; +use stdx::format_to; use crate::{ db::DefDatabase, @@ -246,7 +247,7 @@ impl CrateDefMap { entries.sort_by_key(|(name, _)| name.clone()); for (name, def) in entries { - *buf += &format!("{}:", name); + format_to!(buf, "{}:", name); if def.types.is_some() { *buf += " t"; @@ -265,7 +266,7 @@ impl CrateDefMap { } for (name, child) in map.modules[module].children.iter() { - let path = path.to_string() + &format!("::{}", name); + let path = &format!("{}::{}", path, name); go(buf, map, &path, *child); } } -- cgit v1.2.3