X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Futils.rs;h=520877c79c88ff8ed7b551a1660d0930c66f64fd;hb=90bc40a11179096a9a11a3a2680b680bae9b2034;hp=c22b85f45638d09729c787c4f33be597aef51192;hpb=fb40a2796e6e87d05b14f67a4b38985522f76586;p=rust.git diff --git a/src/utils.rs b/src/utils.rs index c22b85f4563..520877c79c8 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use syntax::ast::Visibility; #[inline] pub fn prev_char(s: &str, mut i: usize) -> usize { @@ -38,3 +39,11 @@ pub fn make_indent(width: usize) -> String { } indent } + +#[inline] +pub fn format_visibility(vis: Visibility) -> &'static str { + match vis { + Visibility::Public => "pub ", + Visibility::Inherited => "" + } +}