Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_ty/src/diagnostics/expr.rs')
-rw-r--r--crates/hir_ty/src/diagnostics/expr.rs34
1 files changed, 2 insertions, 32 deletions
diff --git a/crates/hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs
index 307594d08b..71eb7e3995 100644
--- a/crates/hir_ty/src/diagnostics/expr.rs
+++ b/crates/hir_ty/src/diagnostics/expr.rs
@@ -4,10 +4,7 @@
use std::sync::Arc;
-use hir_def::{
- expr::Statement, path::path, resolver::HasResolver, type_ref::Mutability, AssocItemId,
- DefWithBodyId, HasModule,
-};
+use hir_def::{path::path, resolver::HasResolver, AssocItemId, DefWithBodyId, HasModule};
use hir_expand::name;
use itertools::Either;
use rustc_hash::FxHashSet;
@@ -20,7 +17,7 @@ use crate::{
deconstruct_pat::DeconstructedPat,
usefulness::{compute_match_usefulness, MatchCheckCtx},
},
- AdtId, InferenceResult, Interner, Ty, TyExt, TyKind,
+ InferenceResult, Interner, TyExt,
};
pub(crate) use hir_def::{
@@ -428,30 +425,3 @@ fn types_of_subpatterns_do_match(pat: PatId, body: &Body, infer: &InferenceResul
walk(pat, body, infer, &mut has_type_mismatches);
!has_type_mismatches
}
-
-fn check_missing_refs(
- infer: &InferenceResult,
- arg: ExprId,
- param: &Ty,
-) -> Option<(ExprId, Mutability)> {
- let arg_ty = infer.type_of_expr.get(arg)?;
-
- let reference_one = arg_ty.as_reference();
- let reference_two = param.as_reference();
-
- match (reference_one, reference_two) {
- (None, Some((referenced_ty, _, mutability))) if referenced_ty == arg_ty => {
- Some((arg, Mutability::from_mutable(matches!(mutability, chalk_ir::Mutability::Mut))))
- }
- (None, Some((referenced_ty, _, mutability))) => match referenced_ty.kind(Interner) {
- TyKind::Slice(subst) if matches!(arg_ty.kind(Interner), TyKind::Array(arr_subst, _) if arr_subst == subst) => {
- Some((
- arg,
- Mutability::from_mutable(matches!(mutability, chalk_ir::Mutability::Mut)),
- ))
- }
- _ => None,
- },
- _ => None,
- }
-}