From 86141797dbeb406a6b0a7c6442cc715d3f7bcc75 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 25 Aug 2018 21:19:38 +0200 Subject: [PATCH] Remove static and const initialization from documentation --- src/librustdoc/html/render.rs | 21 ++++----------------- src/test/rustdoc/escape-rust-expr.rs | 2 +- src/test/rustdoc/issue-33302.rs | 4 ++-- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 8d672ffd7bb27..d61855011d36b 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2579,27 +2579,15 @@ fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Vec(&'a str); - -impl<'a> fmt::Display for Initializer<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let Initializer(s) = *self; - if s.is_empty() { return Ok(()); } - write!(f, " = ")?; - write!(f, "{}", Escape(s)) - } -} - fn item_constant(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, c: &clean::Constant) -> fmt::Result { write!(w, "
")?;
     render_attributes(w, it)?;
     write!(w, "{vis}const \
-               {name}: {typ}{init}
", + {name}: {typ}", vis = VisSpace(&it.visibility), name = it.name.as_ref().unwrap(), - typ = c.type_, - init = Initializer(&c.expr))?; + typ = c.type_)?; document(w, cx, it) } @@ -2608,12 +2596,11 @@ fn item_static(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, write!(w, "
")?;
     render_attributes(w, it)?;
     write!(w, "{vis}static {mutability}\
-               {name}: {typ}{init}
", + {name}: {typ}", vis = VisSpace(&it.visibility), mutability = MutableSpace(s.mutability), name = it.name.as_ref().unwrap(), - typ = s.type_, - init = Initializer(&s.expr))?; + typ = s.type_)?; document(w, cx, it) } diff --git a/src/test/rustdoc/escape-rust-expr.rs b/src/test/rustdoc/escape-rust-expr.rs index 7f9a2bf175a5f..4594eb95ea18e 100644 --- a/src/test/rustdoc/escape-rust-expr.rs +++ b/src/test/rustdoc/escape-rust-expr.rs @@ -11,5 +11,5 @@ // Test that we HTML-escape Rust expressions, where HTML special chars // can occur, and we know it's definitely not markup. -// @has escape_rust_expr/constant.CONST_S.html '//pre[@class="rust const"]' '"