From 655f5bc26190b94e237dcc485e405de0d192e6ab Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 24 Dec 2018 15:19:49 +0100 Subject: Rename a variable for consistency --- crates/ra_hir/src/ty.rs | 18 +++++++++--------- crates/ra_hir/src/ty/tests.rs | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index e1edf1bff..c759d4c8b 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs @@ -241,12 +241,12 @@ pub fn type_for_def(db: &impl HirDatabase, def_id: DefId) -> Cancelable { #[derive(Clone, PartialEq, Eq, Debug)] pub struct InferenceResult { - type_for: FxHashMap, + type_of: FxHashMap, } impl InferenceResult { pub fn type_of_node(&self, node: SyntaxNodeRef) -> Option { - self.type_for.get(&LocalSyntaxPtr::new(node)).cloned() + self.type_of.get(&LocalSyntaxPtr::new(node)).cloned() } } @@ -256,13 +256,13 @@ pub struct InferenceContext<'a, D: HirDatabase> { scopes: Arc, module: Module, // TODO unification tables... - type_for: FxHashMap, + type_of: FxHashMap, } impl<'a, D: HirDatabase> InferenceContext<'a, D> { fn new(db: &'a D, scopes: Arc, module: Module) -> Self { InferenceContext { - type_for: FxHashMap::default(), + type_of: FxHashMap::default(), db, scopes, module, @@ -270,7 +270,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { } fn write_ty(&mut self, node: SyntaxNodeRef, ty: Ty) { - self.type_for.insert(LocalSyntaxPtr::new(node), ty); + self.type_of.insert(LocalSyntaxPtr::new(node), ty); } fn unify(&mut self, ty1: &Ty, ty2: &Ty) -> Option { @@ -299,7 +299,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { // resolve locally let name = ctry!(ast_path.segment().and_then(|s| s.name_ref())); if let Some(scope_entry) = self.scopes.resolve_local_name(name) { - let ty = ctry!(self.type_for.get(&scope_entry.ptr())); + let ty = ctry!(self.type_of.get(&scope_entry.ptr())); return Ok(Some(ty.clone())); }; }; @@ -577,10 +577,10 @@ pub fn infer(db: &impl HirDatabase, function: Function) -> Cancelable Cancelable String { .unwrap() .unwrap(); let inference_result = func.infer(&db).unwrap(); - for (syntax_ptr, ty) in &inference_result.type_for { + for (syntax_ptr, ty) in &inference_result.type_of { let node = syntax_ptr.resolve(&source_file); write!( acc, -- cgit v1.2.3