aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-04-10 23:27:00 +0100
committerAleksey Kladov <[email protected]>2020-04-10 23:27:00 +0100
commitc1244c853c6bdc42bf91a77768963c0d287093ff (patch)
treec7f96c8f170c43d4a65451e089783ba6550ca020 /crates/ra_hir_ty
parentca9a5dd1654cc0d54ed5b2bb71ec8ed559470276 (diff)
Forward compat
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r--crates/ra_hir_ty/src/diagnostics.rs10
-rw-r--r--crates/ra_hir_ty/src/expr.rs6
-rw-r--r--crates/ra_hir_ty/src/tests.rs2
3 files changed, 9 insertions, 9 deletions
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs
index 3f18acf1d..927896d6f 100644
--- a/crates/ra_hir_ty/src/diagnostics.rs
+++ b/crates/ra_hir_ty/src/diagnostics.rs
@@ -21,7 +21,7 @@ impl Diagnostic for NoSuchField {
21 } 21 }
22 22
23 fn source(&self) -> InFile<SyntaxNodePtr> { 23 fn source(&self) -> InFile<SyntaxNodePtr> {
24 InFile { file_id: self.file, value: self.field.into() } 24 InFile { file_id: self.file, value: self.field.clone().into() }
25 } 25 }
26 26
27 fn as_any(&self) -> &(dyn Any + Send + 'static) { 27 fn as_any(&self) -> &(dyn Any + Send + 'static) {
@@ -45,7 +45,7 @@ impl Diagnostic for MissingFields {
45 buf 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.clone().into() }
49 } 49 }
50 fn as_any(&self) -> &(dyn Any + Send + 'static) { 50 fn as_any(&self) -> &(dyn Any + Send + 'static) {
51 self 51 self
@@ -78,7 +78,7 @@ impl Diagnostic for MissingPatFields {
78 buf 78 buf
79 } 79 }
80 fn source(&self) -> InFile<SyntaxNodePtr> { 80 fn source(&self) -> InFile<SyntaxNodePtr> {
81 InFile { file_id: self.file, value: self.field_list.into() } 81 InFile { file_id: self.file, value: self.field_list.clone().into() }
82 } 82 }
83 fn as_any(&self) -> &(dyn Any + Send + 'static) { 83 fn as_any(&self) -> &(dyn Any + Send + 'static) {
84 self 84 self
@@ -97,7 +97,7 @@ impl Diagnostic for MissingMatchArms {
97 String::from("Missing match arm") 97 String::from("Missing match arm")
98 } 98 }
99 fn source(&self) -> InFile<SyntaxNodePtr> { 99 fn source(&self) -> InFile<SyntaxNodePtr> {
100 InFile { file_id: self.file, value: self.match_expr.into() } 100 InFile { file_id: self.file, value: self.match_expr.clone().into() }
101 } 101 }
102 fn as_any(&self) -> &(dyn Any + Send + 'static) { 102 fn as_any(&self) -> &(dyn Any + Send + 'static) {
103 self 103 self
@@ -115,7 +115,7 @@ impl Diagnostic for MissingOkInTailExpr {
115 "wrap return expression in Ok".to_string() 115 "wrap return expression in Ok".to_string()
116 } 116 }
117 fn source(&self) -> InFile<SyntaxNodePtr> { 117 fn source(&self) -> InFile<SyntaxNodePtr> {
118 InFile { file_id: self.file, value: self.expr.into() } 118 InFile { file_id: self.file, value: self.expr.clone().into() }
119 } 119 }
120 fn as_any(&self) -> &(dyn Any + Send + 'static) { 120 fn as_any(&self) -> &(dyn Any + Send + 'static) {
121 self 121 self
diff --git a/crates/ra_hir_ty/src/expr.rs b/crates/ra_hir_ty/src/expr.rs
index a7c8d74ab..827b687de 100644
--- a/crates/ra_hir_ty/src/expr.rs
+++ b/crates/ra_hir_ty/src/expr.rs
@@ -89,7 +89,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
89 let (_, source_map) = db.body_with_source_map(self.func.into()); 89 let (_, source_map) = db.body_with_source_map(self.func.into());
90 90
91 if let Ok(source_ptr) = source_map.expr_syntax(id) { 91 if let Ok(source_ptr) = source_map.expr_syntax(id) {
92 if let Some(expr) = source_ptr.value.left() { 92 if let Some(expr) = source_ptr.value.as_ref().left() {
93 let root = source_ptr.file_syntax(db.upcast()); 93 let root = source_ptr.file_syntax(db.upcast());
94 if let ast::Expr::RecordLit(record_lit) = expr.to_node(&root) { 94 if let ast::Expr::RecordLit(record_lit) = expr.to_node(&root) {
95 if let Some(field_list) = record_lit.record_field_list() { 95 if let Some(field_list) = record_lit.record_field_list() {
@@ -120,7 +120,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
120 let (_, source_map) = db.body_with_source_map(self.func.into()); 120 let (_, source_map) = db.body_with_source_map(self.func.into());
121 121
122 if let Ok(source_ptr) = source_map.pat_syntax(id) { 122 if let Ok(source_ptr) = source_map.pat_syntax(id) {
123 if let Some(expr) = source_ptr.value.left() { 123 if let Some(expr) = source_ptr.value.as_ref().left() {
124 let root = source_ptr.file_syntax(db.upcast()); 124 let root = source_ptr.file_syntax(db.upcast());
125 if let ast::Pat::RecordPat(record_pat) = expr.to_node(&root) { 125 if let ast::Pat::RecordPat(record_pat) = expr.to_node(&root) {
126 if let Some(field_list) = record_pat.record_field_pat_list() { 126 if let Some(field_list) = record_pat.record_field_pat_list() {
@@ -205,7 +205,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
205 } 205 }
206 206
207 if let Ok(source_ptr) = source_map.expr_syntax(id) { 207 if let Ok(source_ptr) = source_map.expr_syntax(id) {
208 if let Some(expr) = source_ptr.value.left() { 208 if let Some(expr) = source_ptr.value.as_ref().left() {
209 let root = source_ptr.file_syntax(db.upcast()); 209 let root = source_ptr.file_syntax(db.upcast());
210 if let ast::Expr::MatchExpr(match_expr) = expr.to_node(&root) { 210 if let ast::Expr::MatchExpr(match_expr) = expr.to_node(&root) {
211 if let (Some(match_expr), Some(arms)) = 211 if let (Some(match_expr), Some(arms)) =
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs
index 47a7b9ffd..54e31602f 100644
--- a/crates/ra_hir_ty/src/tests.rs
+++ b/crates/ra_hir_ty/src/tests.rs
@@ -87,7 +87,7 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
87 } 87 }
88 Err(SyntheticSyntax) => continue, 88 Err(SyntheticSyntax) => continue,
89 }; 89 };
90 types.push((syntax_ptr, ty)); 90 types.push((syntax_ptr.clone(), ty));
91 if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr) { 91 if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr) {
92 mismatches.push((syntax_ptr, mismatch)); 92 mismatches.push((syntax_ptr, mismatch));
93 } 93 }