Skip to content

Commit 8614179

Browse files
Remove static and const initialization from documentation
1 parent a00706a commit 8614179

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-20
lines changed

src/librustdoc/html/render.rs

+4-17
Original file line numberDiff line numberDiff line change
@@ -2579,27 +2579,15 @@ fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Vec<S
25792579
stability
25802580
}
25812581

2582-
struct Initializer<'a>(&'a str);
2583-
2584-
impl<'a> fmt::Display for Initializer<'a> {
2585-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2586-
let Initializer(s) = *self;
2587-
if s.is_empty() { return Ok(()); }
2588-
write!(f, "<code> = </code>")?;
2589-
write!(f, "<code>{}</code>", Escape(s))
2590-
}
2591-
}
2592-
25932582
fn item_constant(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
25942583
c: &clean::Constant) -> fmt::Result {
25952584
write!(w, "<pre class='rust const'>")?;
25962585
render_attributes(w, it)?;
25972586
write!(w, "{vis}const \
2598-
{name}: {typ}{init}</pre>",
2587+
{name}: {typ}</pre>",
25992588
vis = VisSpace(&it.visibility),
26002589
name = it.name.as_ref().unwrap(),
2601-
typ = c.type_,
2602-
init = Initializer(&c.expr))?;
2590+
typ = c.type_)?;
26032591
document(w, cx, it)
26042592
}
26052593

@@ -2608,12 +2596,11 @@ fn item_static(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
26082596
write!(w, "<pre class='rust static'>")?;
26092597
render_attributes(w, it)?;
26102598
write!(w, "{vis}static {mutability}\
2611-
{name}: {typ}{init}</pre>",
2599+
{name}: {typ}</pre>",
26122600
vis = VisSpace(&it.visibility),
26132601
mutability = MutableSpace(s.mutability),
26142602
name = it.name.as_ref().unwrap(),
2615-
typ = s.type_,
2616-
init = Initializer(&s.expr))?;
2603+
typ = s.type_)?;
26172604
document(w, cx, it)
26182605
}
26192606

src/test/rustdoc/escape-rust-expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
// Test that we HTML-escape Rust expressions, where HTML special chars
1212
// can occur, and we know it's definitely not markup.
1313

14-
// @has escape_rust_expr/constant.CONST_S.html '//pre[@class="rust const"]' '"<script>"'
14+
// @!has escape_rust_expr/constant.CONST_S.html '//pre[@class="rust const"]' '"<script>"'
1515
pub const CONST_S: &'static str = "<script>";

src/test/rustdoc/issue-33302.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ macro_rules! make {
1717
pub struct S;
1818

1919
// @has issue_33302/constant.CST.html \
20-
// '//pre[@class="rust const"]' 'pub const CST: i32 = 4 * 4'
20+
// '//pre[@class="rust const"]' 'pub const CST: i32'
2121
pub const CST: i32 = ($n * $n);
2222
// @has issue_33302/static.ST.html \
23-
// '//pre[@class="rust static"]' 'pub static ST: i32 = 4 * 4'
23+
// '//pre[@class="rust static"]' 'pub static ST: i32'
2424
pub static ST: i32 = ($n * $n);
2525

2626
pub trait T<X> {

0 commit comments

Comments
 (0)