aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Ellison <[email protected]>2021-01-03 08:54:33 +0000
committerPhil Ellison <[email protected]>2021-01-03 08:54:33 +0000
commitee7c3f79e29bf140fe6faaf52bee63dba2fc29b1 (patch)
tree45745debcb950ba5422fc73faa42ae6d7255d38f
parent609a069757aa071c377c0e02d7b18b4ff7b32631 (diff)
Use stdx::format_to instead of writeln
-rw-r--r--crates/hir/src/code_model.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs
index f68299d3a..804cdb143 100644
--- a/crates/hir/src/code_model.rs
+++ b/crates/hir/src/code_model.rs
@@ -1,5 +1,5 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2use std::{fmt::Write, iter, sync::Arc}; 2use std::{iter, sync::Arc};
3 3
4use arrayvec::ArrayVec; 4use arrayvec::ArrayVec;
5use base_db::{CrateDisplayName, CrateId, Edition, FileId}; 5use base_db::{CrateDisplayName, CrateId, Edition, FileId};
@@ -39,7 +39,7 @@ use hir_ty::{
39 TyDefId, TyKind, TypeCtor, 39 TyDefId, TyKind, TypeCtor,
40}; 40};
41use rustc_hash::FxHashSet; 41use rustc_hash::FxHashSet;
42use stdx::impl_from; 42use stdx::{format_to, impl_from};
43use syntax::{ 43use syntax::{
44 ast::{self, AttrsOwner, NameOwner}, 44 ast::{self, AttrsOwner, NameOwner},
45 AstNode, SmolStr, 45 AstNode, SmolStr,
@@ -803,9 +803,9 @@ impl Function {
803 let body = db.body(self.id.into()); 803 let body = db.body(self.id.into());
804 804
805 let mut result = String::new(); 805 let mut result = String::new();
806 writeln!(&mut result, "HIR expressions in the body of `{}`:", self.name(db)).unwrap(); 806 format_to!(result, "HIR expressions in the body of `{}`:\n", self.name(db));
807 for (id, expr) in body.exprs.iter() { 807 for (id, expr) in body.exprs.iter() {
808 writeln!(&mut result, "{:?}: {:?}", id, expr).unwrap(); 808 format_to!(result, "{:?}: {:?}\n", id, expr);
809 } 809 }
810 810
811 result 811 result