Skip to content

Commit 0d69a02

Browse files
committed
Removed/Updated some cases and simplified match
1 parent c4396f4 commit 0d69a02

File tree

2 files changed

+4
-29
lines changed

2 files changed

+4
-29
lines changed

src/librustdoc/html/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,7 @@ crate fn print_constness_with_space(
12841284
)
12851285
| (hir::Constness::Const, None) => "const ",
12861286
// const unstable or not const
1287-
(hir::Constness::Const, _) | (hir::Constness::NotConst, _) => "",
1287+
_ => "",
12881288
}
12891289
}
12901290

src/test/rustdoc/const-display.rs

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,51 +20,32 @@ pub const fn foo() -> u32 { 42 }
2020
pub const unsafe fn foo_unsafe() -> u32 { 42 }
2121

2222
// @has 'foo/fn.foo2.html' '//pre' 'pub const fn foo2() -> u32'
23+
// @!has - '//span[@class="since"]'
2324
#[unstable(feature = "humans", issue = "none")]
2425
pub const fn foo2() -> u32 { 42 }
2526

26-
// @has 'foo/fn.foo2_unsafe.html' '//pre' 'pub const unsafe fn foo2_unsafe() -> u32'
27-
#[unstable(feature = "humans", issue = "none")]
28-
pub const unsafe fn foo2_unsafe() -> u32 { 42 }
29-
3027
// @has 'foo/fn.bar2.html' '//pre' 'pub const fn bar2() -> u32'
3128
// @has - //span '1.0.0 (const: 1.0.0)'
3229
#[stable(feature = "rust1", since = "1.0.0")]
3330
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
3431
pub const fn bar2() -> u32 { 42 }
3532

36-
// @has 'foo/fn.bar2_unsafe.html' '//pre' 'pub const unsafe fn bar2_unsafe() -> u32'
37-
// @has - //span '1.0.0 (const: 1.0.0)'
38-
#[stable(feature = "rust1", since = "1.0.0")]
39-
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
40-
pub const unsafe fn bar2_unsafe() -> u32 { 42 }
4133

4234
// @has 'foo/fn.foo2_gated.html' '//pre' 'pub const fn foo2_gated() -> u32'
35+
// @!has - '//span[@class="since"]'
4336
#[unstable(feature = "foo2", issue = "none")]
4437
pub const fn foo2_gated() -> u32 { 42 }
4538

46-
// @has 'foo/fn.foo2_gated_unsafe.html' '//pre' 'pub const unsafe fn foo2_gated_unsafe() -> u32'
47-
#[unstable(feature = "foo2", issue = "none")]
48-
pub const unsafe fn foo2_gated_unsafe() -> u32 { 42 }
49-
5039
// @has 'foo/fn.bar2_gated.html' '//pre' 'pub const fn bar2_gated() -> u32'
5140
// @has - '//span[@class="since"]' '1.0.0 (const: 1.0.0)'
5241
#[stable(feature = "rust1", since = "1.0.0")]
5342
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
5443
pub const fn bar2_gated() -> u32 { 42 }
5544

56-
// @has 'foo/fn.bar2_gated_unsafe.html' '//pre' 'pub const unsafe fn bar2_gated_unsafe() -> u32'
57-
// @has - '//span[@class="since"]' '1.0.0 (const: 1.0.0)'
58-
#[stable(feature = "rust1", since = "1.0.0")]
59-
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
60-
pub const unsafe fn bar2_gated_unsafe() -> u32 { 42 }
61-
6245
// @has 'foo/fn.bar_not_gated.html' '//pre' 'pub const fn bar_not_gated() -> u32'
46+
// @!has - '//span[@class="since"]'
6347
pub const fn bar_not_gated() -> u32 { 42 }
6448

65-
// @has 'foo/fn.bar_not_gated_unsafe.html' '//pre' 'pub const unsafe fn bar_not_gated_unsafe() -> u32'
66-
pub const unsafe fn bar_not_gated_unsafe() -> u32 { 42 }
67-
6849
pub struct Foo;
6950

7051
impl Foo {
@@ -85,10 +66,4 @@ impl Foo {
8566
#[stable(feature = "rust1", since = "1.0.0")]
8667
#[rustc_const_stable(feature = "rust1", since = "1.2.0")]
8768
pub const fn stable_impl() -> u32 { 42 }
88-
89-
// @has 'foo/struct.Foo.html' '//div[@id="method.stable_impl_unsafe"]/code' 'pub const unsafe fn stable_impl_unsafe() -> u32'
90-
// @has - '//span[@class="since"]' '1.0.0 (const: 1.2.0)'
91-
#[stable(feature = "rust1", since = "1.0.0")]
92-
#[rustc_const_stable(feature = "rust1", since = "1.2.0")]
93-
pub const unsafe fn stable_impl_unsafe() -> u32 { 42 }
9469
}

0 commit comments

Comments
 (0)