Reduce visibility

This commit is contained in:
Aleksey Kladov 2019-11-24 16:47:29 +03:00
parent 5cc634fa60
commit 326f066aa2
2 changed files with 11 additions and 8 deletions

View File

@ -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 @@ pub fn expand_use_item(
}
}
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 @@ pub fn from_ast(path: ast::Path) -> Option<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 @@ pub fn is_type_relative(&self) -> bool {
}
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());

View File

@ -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 @@ pub fn from_ast(node: ast::TypeRef) -> Self {
}
}
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 @@ pub fn from_ast_opt(node: Option<ast::TypeRef>) -> Self {
}
}
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() {