From 326f066aa21ed2f40f064d0a6c1bdf7d519bfd7b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 24 Nov 2019 16:47:29 +0300 Subject: Reduce visibility --- crates/ra_hir_def/src/path.rs | 11 +++++++---- crates/ra_hir_def/src/type_ref.rs | 8 ++++---- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'crates/ra_hir_def/src') diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs index 626ebffdc..94f6a27bc 100644 --- a/crates/ra_hir_def/src/path.rs +++ b/crates/ra_hir_def/src/path.rs @@ -66,7 +66,7 @@ pub enum PathKind { impl Path { /// Calls `cb` with all paths, represented by this use item. - pub fn expand_use_item( + pub(crate) fn expand_use_item( item_src: Source, hygiene: &Hygiene, mut cb: impl FnMut(Path, &ast::UseTree, bool, Option), @@ -76,7 +76,10 @@ impl Path { } } - pub fn from_simple_segments(kind: PathKind, segments: impl IntoIterator) -> Path { + pub(crate) fn from_simple_segments( + kind: PathKind, + segments: impl IntoIterator, + ) -> Path { Path { kind, segments: segments @@ -94,7 +97,7 @@ impl Path { /// Converts an `ast::Path` to `Path`. Works with use trees. /// It correctly handles `$crate` based path from macro call. - pub fn from_src(mut path: ast::Path, hygiene: &Hygiene) -> Option { + pub(crate) fn from_src(mut path: ast::Path, hygiene: &Hygiene) -> Option { let mut kind = PathKind::Plain; let mut segments = Vec::new(); loop { @@ -227,7 +230,7 @@ impl Path { } impl GenericArgs { - pub fn from_ast(node: ast::TypeArgList) -> Option { + pub(crate) fn from_ast(node: ast::TypeArgList) -> Option { let mut args = Vec::new(); for type_arg in node.type_args() { let type_ref = TypeRef::from_ast_opt(type_arg.type_ref()); diff --git a/crates/ra_hir_def/src/type_ref.rs b/crates/ra_hir_def/src/type_ref.rs index 8af061116..5f10e9a88 100644 --- a/crates/ra_hir_def/src/type_ref.rs +++ b/crates/ra_hir_def/src/type_ref.rs @@ -64,7 +64,7 @@ pub enum TypeBound { impl TypeRef { /// Converts an `ast::TypeRef` to a `hir::TypeRef`. - pub fn from_ast(node: ast::TypeRef) -> Self { + pub(crate) fn from_ast(node: ast::TypeRef) -> Self { match node { ast::TypeRef::ParenType(inner) => TypeRef::from_ast_opt(inner.type_ref()), ast::TypeRef::TupleType(inner) => { @@ -113,7 +113,7 @@ impl TypeRef { } } - pub fn from_ast_opt(node: Option) -> Self { + pub(crate) fn from_ast_opt(node: Option) -> Self { if let Some(node) = node { TypeRef::from_ast(node) } else { @@ -121,7 +121,7 @@ impl TypeRef { } } - pub fn unit() -> TypeRef { + pub(crate) fn unit() -> TypeRef { TypeRef::Tuple(Vec::new()) } } @@ -135,7 +135,7 @@ pub(crate) fn type_bounds_from_ast(type_bounds_opt: Option) } impl TypeBound { - pub fn from_ast(node: ast::TypeBound) -> Self { + pub(crate) fn from_ast(node: ast::TypeBound) -> Self { match node.kind() { ast::TypeBoundKind::PathType(path_type) => { let path = match path_type.path() { -- cgit v1.2.3