diff options
author | ivan770 <[email protected]> | 2020-12-08 19:25:21 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-08 19:25:21 +0000 |
commit | 7738467e0a11c9878d9e9486daeb0dc18d93b8e8 (patch) | |
tree | 120deed19fa7f4e4789331f41ae6609ac8136ae4 /crates/hir_ty | |
parent | f2950a135036a608ccdcff3f5da77561927d6952 (diff) |
Format code
Diffstat (limited to 'crates/hir_ty')
-rw-r--r-- | crates/hir_ty/src/diagnostics/expr.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/crates/hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs index 6ec15c180..98b3cade2 100644 --- a/crates/hir_ty/src/diagnostics/expr.rs +++ b/crates/hir_ty/src/diagnostics/expr.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use std::sync::Arc; | 3 | use std::sync::Arc; |
4 | 4 | ||
5 | use hir_def::{AdtId, DefWithBodyId, expr::Statement, path::path, resolver::HasResolver}; | 5 | use hir_def::{expr::Statement, path::path, resolver::HasResolver, AdtId, DefWithBodyId}; |
6 | use hir_expand::diagnostics::DiagnosticSink; | 6 | use hir_expand::diagnostics::DiagnosticSink; |
7 | use rustc_hash::FxHashSet; | 7 | use rustc_hash::FxHashSet; |
8 | use syntax::{ast, AstPtr}; | 8 | use syntax::{ast, AstPtr}; |
@@ -11,7 +11,8 @@ use crate::{ | |||
11 | db::HirDatabase, | 11 | db::HirDatabase, |
12 | diagnostics::{ | 12 | diagnostics::{ |
13 | match_check::{is_useful, MatchCheckCtx, Matrix, PatStack, Usefulness}, | 13 | match_check::{is_useful, MatchCheckCtx, Matrix, PatStack, Usefulness}, |
14 | MismatchedArgCount, MissingFields, MissingMatchArms, MissingOkInTailExpr, MissingPatFields, RemoveThisSemicolon | 14 | MismatchedArgCount, MissingFields, MissingMatchArms, MissingOkInTailExpr, MissingPatFields, |
15 | RemoveThisSemicolon, | ||
15 | }, | 16 | }, |
16 | utils::variant_data, | 17 | utils::variant_data, |
17 | ApplicationTy, InferenceResult, Ty, TypeCtor, | 18 | ApplicationTy, InferenceResult, Ty, TypeCtor, |
@@ -324,7 +325,12 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
324 | } | 325 | } |
325 | } | 326 | } |
326 | 327 | ||
327 | fn validate_missing_tail_expr(&mut self, body_id: ExprId, possible_tail_id: ExprId, db: &dyn HirDatabase) { | 328 | fn validate_missing_tail_expr( |
329 | &mut self, | ||
330 | body_id: ExprId, | ||
331 | possible_tail_id: ExprId, | ||
332 | db: &dyn HirDatabase, | ||
333 | ) { | ||
328 | let mismatch = match self.infer.type_mismatch_for_expr(body_id) { | 334 | let mismatch = match self.infer.type_mismatch_for_expr(body_id) { |
329 | Some(m) => m, | 335 | Some(m) => m, |
330 | None => return, | 336 | None => return, |
@@ -335,7 +341,10 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
335 | let (_, source_map) = db.body_with_source_map(self.owner.into()); | 341 | let (_, source_map) = db.body_with_source_map(self.owner.into()); |
336 | 342 | ||
337 | if let Ok(source_ptr) = source_map.expr_syntax(possible_tail_id) { | 343 | if let Ok(source_ptr) = source_map.expr_syntax(possible_tail_id) { |
338 | self.sink.push(RemoveThisSemicolon { file: source_ptr.file_id, expr: source_ptr.value }); | 344 | self.sink.push(RemoveThisSemicolon { |
345 | file: source_ptr.file_id, | ||
346 | expr: source_ptr.value, | ||
347 | }); | ||
339 | } | 348 | } |
340 | } | 349 | } |
341 | } | 350 | } |