diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs index 626ebffdc89..94f6a27bc43 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<ast::UseItem>, hygiene: &Hygiene, mut cb: impl FnMut(Path, &ast::UseTree, bool, Option<Name>), @@ -76,7 +76,10 @@ impl Path { } } - pub fn from_simple_segments(kind: PathKind, segments: impl IntoIterator<Item = Name>) -> Path { + pub(crate) fn from_simple_segments( + kind: PathKind, + segments: impl IntoIterator<Item = Name>, + ) -> 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<Path> { + pub(crate) fn from_src(mut path: ast::Path, hygiene: &Hygiene) -> Option<Path> { 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<GenericArgs> { + pub(crate) fn from_ast(node: ast::TypeArgList) -> Option<GenericArgs> { 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 8af061116de..5f10e9a88ba 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<ast::TypeRef>) -> Self { + pub(crate) fn from_ast_opt(node: Option<ast::TypeRef>) -> 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<ast::TypeBoundList>) } 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() {