aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/diagnostics.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-03-28 11:28:31 +0000
committerGitHub <[email protected]>2020-03-28 11:28:31 +0000
commitc30425dc96895117b644f29b758cee9dac36839b (patch)
treed3ccef4aa8f681cc9de29f0435ad20e87911a6ba /crates/ra_hir_ty/src/diagnostics.rs
parenta1fea0d34ee8f3436aefd87d4c133a7ff50ffbb0 (diff)
parent311cbbdad599d51c6f08f7dd72c299f7c0128bb2 (diff)
Merge #3753
3753: Introduce stdx crate r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/diagnostics.rs')
-rw-r--r--crates/ra_hir_ty/src/diagnostics.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs
index 6eafdc8f6..0f8522021 100644
--- a/crates/ra_hir_ty/src/diagnostics.rs
+++ b/crates/ra_hir_ty/src/diagnostics.rs
@@ -4,6 +4,7 @@ use std::any::Any;
4 4
5use hir_expand::{db::AstDatabase, name::Name, HirFileId, InFile}; 5use hir_expand::{db::AstDatabase, name::Name, HirFileId, InFile};
6use ra_syntax::{ast, AstNode, AstPtr, SyntaxNodePtr}; 6use ra_syntax::{ast, AstNode, AstPtr, SyntaxNodePtr};
7use stdx::format_to;
7 8
8pub use hir_def::diagnostics::UnresolvedModule; 9pub use hir_def::diagnostics::UnresolvedModule;
9pub use hir_expand::diagnostics::{AstDiagnostic, Diagnostic, DiagnosticSink}; 10pub use hir_expand::diagnostics::{AstDiagnostic, Diagnostic, DiagnosticSink};
@@ -37,12 +38,11 @@ pub struct MissingFields {
37 38
38impl Diagnostic for MissingFields { 39impl Diagnostic for MissingFields {
39 fn message(&self) -> String { 40 fn message(&self) -> String {
40 use std::fmt::Write; 41 let mut buf = String::from("Missing structure fields:\n");
41 let mut message = String::from("Missing structure fields:\n");
42 for field in &self.missed_fields { 42 for field in &self.missed_fields {
43 writeln!(message, "- {}", field).unwrap(); 43 format_to!(buf, "- {}", field);
44 } 44 }
45 message 45 buf
46 } 46 }
47 fn source(&self) -> InFile<SyntaxNodePtr> { 47 fn source(&self) -> InFile<SyntaxNodePtr> {
48 InFile { file_id: self.file, value: self.field_list.into() } 48 InFile { file_id: self.file, value: self.field_list.into() }