]> git.lizzy.rs Git - rust.git/blobdiff - src/utils.rs
Implement basic enum formatting
[rust.git] / src / utils.rs
index c22b85f45638d09729c787c4f33be597aef51192..520877c79c88ff8ed7b551a1660d0930c66f64fd 100644 (file)
@@ -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 => ""
+    }
+}