aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/diagnostics.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-25 13:42:36 +0000
committerGitHub <[email protected]>2019-11-25 13:42:36 +0000
commitbe00d74c7b61fb82bdade482e95035a21f9dd736 (patch)
tree95dc85c347125501486396c824aaf31e5f1be5f9 /crates/ra_hir/src/diagnostics.rs
parentdf25dd4d882d7521140458b60f486c2f617608ee (diff)
parent66f04e6be54c47104877bff777b7042960d04393 (diff)
Merge #2388
2388: Show missing struct fields in the error message r=matklad a=Frizi This provides the most interesting information about the "missing structure fields" error directly to the user. Co-authored-by: Frizi <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/diagnostics.rs')
-rw-r--r--crates/ra_hir/src/diagnostics.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/ra_hir/src/diagnostics.rs b/crates/ra_hir/src/diagnostics.rs
index dafacba70..6db499e06 100644
--- a/crates/ra_hir/src/diagnostics.rs
+++ b/crates/ra_hir/src/diagnostics.rs
@@ -39,7 +39,12 @@ pub struct MissingFields {
39 39
40impl Diagnostic for MissingFields { 40impl Diagnostic for MissingFields {
41 fn message(&self) -> String { 41 fn message(&self) -> String {
42 "fill structure fields".to_string() 42 use std::fmt::Write;
43 let mut message = String::from("Missing structure fields:\n");
44 for field in &self.missed_fields {
45 write!(message, "- {}\n", field).unwrap();
46 }
47 message
43 } 48 }
44 fn source(&self) -> Source<SyntaxNodePtr> { 49 fn source(&self) -> Source<SyntaxNodePtr> {
45 Source { file_id: self.file, value: self.field_list.into() } 50 Source { file_id: self.file, value: self.field_list.into() }