about summary refs log tree commit diff
path: root/src/librustdoc/html/format.rs
diff options
context:
space:
mode:
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-03-25 06:08:11 +0000
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-04-07 04:31:45 +0000
commitbb66d91c98d83ac5fc453f120ef4a810bc8939a5 (patch)
treec586ee4feff214b64552844813e49ee21333e4e0 /src/librustdoc/html/format.rs
parentffbbf241868588c5ca3880ed023e97aa806ea1d3 (diff)
downloadrust-bb66d91c98d83ac5fc453f120ef4a810bc8939a5.tar.gz
rust-bb66d91c98d83ac5fc453f120ef4a810bc8939a5.zip
Make `hir::Visibility` non-copyable and add `ty::Visibility`
Diffstat (limited to 'src/librustdoc/html/format.rs')
-rw-r--r--src/librustdoc/html/format.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index a43711a3273..ce20ad05acb 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -31,7 +31,7 @@ use html::render::{cache, CURRENT_LOCATION_KEY};
 /// Helper to render an optional visibility with a space after it (if the
 /// visibility is preset)
 #[derive(Copy, Clone)]
-pub struct VisSpace(pub Option<hir::Visibility>);
+pub struct VisSpace<'a>(pub &'a Option<hir::Visibility>);
 /// Similarly to VisSpace, this structure is used to render a function style with a
 /// space after it.
 #[derive(Copy, Clone)]
@@ -56,9 +56,9 @@ pub struct TyParamBounds<'a>(pub &'a [clean::TyParamBound]);
 pub struct CommaSep<'a, T: 'a>(pub &'a [T]);
 pub struct AbiSpace(pub Abi);
 
-impl VisSpace {
-    pub fn get(&self) -> Option<hir::Visibility> {
-        let VisSpace(v) = *self; v
+impl<'a> VisSpace<'a> {
+    pub fn get(self) -> &'a Option<hir::Visibility> {
+        let VisSpace(v) = self; v
     }
 }
 
@@ -636,9 +636,9 @@ impl<'a> fmt::Display for Method<'a> {
     }
 }
 
-impl fmt::Display for VisSpace {
+impl<'a> fmt::Display for VisSpace<'a> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        match self.get() {
+        match *self.get() {
             Some(hir::Public) => write!(f, "pub "),
             Some(hir::Inherited) | None => Ok(())
         }