]> git.proxmox.com Git - rustc.git/blame - src/test/rustdoc/whitespace-after-where-clause.rs
Update unsuspicious file list
[rustc.git] / src / test / rustdoc / whitespace-after-where-clause.rs
CommitLineData
064997fb
FG
1// This test ensures there is no whitespace before the first brace of
2// trait, enum, struct and union items when they have a where clause.
3
4#![crate_name = "foo"]
5
6// @has 'foo/trait.ToOwned.html'
2b03887a 7// @snapshot trait - '//*[@class="item-decl"]'
064997fb
FG
8pub trait ToOwned<T>
9where T: Clone
10{
11 type Owned;
12 fn to_owned(&self) -> Self::Owned;
13 fn whatever(&self) -> T;
14}
15
16// @has 'foo/trait.ToOwned2.html'
2b03887a 17// @snapshot trait2 - '//*[@class="item-decl"]'
064997fb
FG
18// There should be a whitespace before `{` in this case!
19pub trait ToOwned2<T: Clone> {
20 type Owned;
21 fn to_owned(&self) -> Self::Owned;
22 fn whatever(&self) -> T;
23}
24
25// @has 'foo/enum.Cow.html'
2b03887a 26// @snapshot enum - '//*[@class="item-decl"]'
064997fb
FG
27pub enum Cow<'a, B: ?Sized + 'a>
28where
29 B: ToOwned<Clone>,
30{
31 Borrowed(&'a B),
32 Whatever(u32),
33}
34
35// @has 'foo/enum.Cow2.html'
2b03887a 36// @snapshot enum2 - '//*[@class="item-decl"]'
064997fb
FG
37// There should be a whitespace before `{` in this case!
38pub enum Cow2<'a, B: ?Sized + ToOwned<Clone> + 'a> {
39 Borrowed(&'a B),
40 Whatever(u32),
41}
42
43// @has 'foo/struct.Struct.html'
2b03887a 44// @snapshot struct - '//*[@class="item-decl"]'
064997fb
FG
45pub struct Struct<'a, B: ?Sized + 'a>
46where
47 B: ToOwned<Clone>,
48{
49 pub a: &'a B,
50 pub b: u32,
51}
52
53// @has 'foo/struct.Struct2.html'
2b03887a 54// @snapshot struct2 - '//*[@class="item-decl"]'
064997fb
FG
55// There should be a whitespace before `{` in this case!
56pub struct Struct2<'a, B: ?Sized + ToOwned<Clone> + 'a> {
57 pub a: &'a B,
58 pub b: u32,
59}
60
61// @has 'foo/union.Union.html'
2b03887a 62// @snapshot union - '//*[@class="item-decl"]'
064997fb
FG
63pub union Union<'a, B: ?Sized + 'a>
64where
65 B: ToOwned<Clone>,
66{
67 a: &'a B,
68 b: u32,
69}
70
71// @has 'foo/union.Union2.html'
2b03887a 72// @snapshot union2 - '//*[@class="item-decl"]'
064997fb
FG
73// There should be a whitespace before `{` in this case!
74pub union Union2<'a, B: ?Sized + ToOwned<Clone> + 'a> {
75 a: &'a B,
76 b: u32,
77}