Skip to content

Commit 778958f

Browse files
committed
make lint-group-style test a UI rather than a compile-fail test
As suggested by Niko Matsakis in review (#38103 (comment)) regarding the endeavor prompted by #36846.
1 parent 9301446 commit 778958f

File tree

3 files changed

+103
-51
lines changed

3 files changed

+103
-51
lines changed

src/test/compile-fail/lint-group-style.rs

-51
This file was deleted.

src/test/ui/lint/lint-group-style.rs

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2014–2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![deny(bad_style)]
12+
#![allow(dead_code)]
13+
14+
fn CamelCase() {}
15+
16+
#[allow(bad_style)]
17+
mod test {
18+
fn CamelCase() {}
19+
20+
#[forbid(bad_style)]
21+
mod bad {
22+
fn CamelCase() {}
23+
24+
static bad: isize = 1;
25+
}
26+
27+
mod warn {
28+
#![warn(bad_style)]
29+
30+
fn CamelCase() {}
31+
32+
struct snake_case;
33+
}
34+
}
35+
36+
fn main() {}
+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
error: function `CamelCase` should have a snake case name such as `camel_case`
2+
--> $DIR/lint-group-style.rs:14:1
3+
|
4+
14 | fn CamelCase() {}
5+
| ^^^^^^^^^^^^^^^^^
6+
|
7+
= note: #[deny(bad_style)] implies #[deny(non_snake_case)]
8+
note: lint level defined here
9+
--> $DIR/lint-group-style.rs:11:9
10+
|
11+
11 | #![deny(bad_style)]
12+
| ^^^^^^^^^
13+
14+
error: function `CamelCase` should have a snake case name such as `camel_case`
15+
--> $DIR/lint-group-style.rs:22:9
16+
|
17+
22 | fn CamelCase() {}
18+
| ^^^^^^^^^^^^^^^^^
19+
|
20+
= note: #[forbid(bad_style)] implies #[forbid(non_snake_case)]
21+
note: lint level defined here
22+
--> $DIR/lint-group-style.rs:20:14
23+
|
24+
20 | #[forbid(bad_style)]
25+
| ^^^^^^^^^
26+
27+
error: static variable `bad` should have an upper case name such as `BAD`
28+
--> $DIR/lint-group-style.rs:24:9
29+
|
30+
24 | static bad: isize = 1;
31+
| ^^^^^^^^^^^^^^^^^^^^^^
32+
|
33+
= note: #[forbid(bad_style)] implies #[forbid(non_upper_case_globals)]
34+
note: lint level defined here
35+
--> $DIR/lint-group-style.rs:20:14
36+
|
37+
20 | #[forbid(bad_style)]
38+
| ^^^^^^^^^
39+
40+
warning: function `CamelCase` should have a snake case name such as `camel_case`
41+
--> $DIR/lint-group-style.rs:30:9
42+
|
43+
30 | fn CamelCase() {}
44+
| ^^^^^^^^^^^^^^^^^
45+
|
46+
= note: #[warn(bad_style)] implies #[warn(non_snake_case)]
47+
note: lint level defined here
48+
--> $DIR/lint-group-style.rs:28:17
49+
|
50+
28 | #![warn(bad_style)]
51+
| ^^^^^^^^^
52+
53+
warning: type `snake_case` should have a camel case name such as `SnakeCase`
54+
--> $DIR/lint-group-style.rs:32:9
55+
|
56+
32 | struct snake_case;
57+
| ^^^^^^^^^^^^^^^^^^
58+
|
59+
= note: #[warn(bad_style)] implies #[warn(non_camel_case_types)]
60+
note: lint level defined here
61+
--> $DIR/lint-group-style.rs:28:17
62+
|
63+
28 | #![warn(bad_style)]
64+
| ^^^^^^^^^
65+
66+
error: aborting due to 3 previous errors
67+

0 commit comments

Comments
 (0)