From 6f1ee9a7f4987d5286e6d875f544ce11f02465f3 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 5 Apr 2021 04:27:57 +0200 Subject: simplify visibility.rs --- crates/hir_def/src/visibility.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/hir_def/src/visibility.rs b/crates/hir_def/src/visibility.rs index 7d00a37c4..9908cd926 100644 --- a/crates/hir_def/src/visibility.rs +++ b/crates/hir_def/src/visibility.rs @@ -11,7 +11,7 @@ use crate::{ nameres::DefMap, path::{ModPath, PathKind}, resolver::HasResolver, - FunctionId, HasModule, LocalFieldId, ModuleDefId, ModuleId, VariantId, + FunctionId, HasModule, LocalFieldId, ModuleId, VariantId, }; /// Visibility of an item, not yet resolved. @@ -25,7 +25,7 @@ pub enum RawVisibility { } impl RawVisibility { - pub(crate) const fn private() -> RawVisibility { + pub(crate) fn private() -> RawVisibility { RawVisibility::Module(ModPath::from_kind(PathKind::Super(0))) } @@ -217,6 +217,6 @@ pub(crate) fn field_visibilities_query( /// Resolve visibility of a function. pub(crate) fn function_visibility_query(db: &dyn DefDatabase, def: FunctionId) -> Visibility { - let resolver = ModuleDefId::from(def).module(db).unwrap().resolver(db); + let resolver = def.resolver(db); db.function_data(def).visibility.resolve(db, &resolver) } -- cgit v1.2.3