@@ -41,20 +41,23 @@ Update the file with some examples to get started:
4141struct A ;
4242impl A {
4343 pub fn fo (& self ) {}
44- pub fn foo (& self ) {} // ~ ERROR: function called "foo"
44+ pub fn foo (& self ) {}
45+ // ~^ foo_functions
4546 pub fn food (& self ) {}
4647}
4748
4849// Default trait methods
4950trait B {
5051 fn fo (& self ) {}
51- fn foo (& self ) {} // ~ ERROR: function called "foo"
52+ fn foo (& self ) {}
53+ // ~^ foo_functions
5254 fn food (& self ) {}
5355}
5456
5557// Plain functions
5658fn fo () {}
57- fn foo () {} // ~ ERROR: function called "foo"
59+ fn foo () {}
60+ // ~^ foo_functions
5861fn food () {}
5962
6063fn main () {
@@ -66,19 +69,38 @@ fn main() {
6669```
6770
6871Without actual lint logic to emit the lint when we see a ` foo ` function name,
69- this test will just pass , because no lint will be emitted. However, we can now
70- run the test with the following command:
72+ this test will fail , because we expect errors at lines marked with
73+ ` //~^ foo_functions ` . However, we can now run the test with the following command:
7174
7275``` sh
7376$ TESTNAME=foo_functions cargo uitest
7477```
7578
76- Clippy will compile and it will conclude with an ` ok ` for the tests :
79+ Clippy will compile and it will fail complaining it didn't receive any errors :
7780
7881```
7982...Clippy warnings and test outputs...
80- test compile_test ... ok
81- test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.48s
83+ error: diagnostic code `clippy::foo_functions` not found on line 8
84+ --> tests/ui/foo_functions.rs:9:10
85+ |
86+ 9 | //~^ foo_functions
87+ | ^^^^^^^^^^^^^ expected because of this pattern
88+ |
89+
90+ error: diagnostic code `clippy::foo_functions` not found on line 16
91+ --> tests/ui/foo_functions.rs:17:10
92+ |
93+ 17 | //~^ foo_functions
94+ | ^^^^^^^^^^^^^ expected because of this pattern
95+ |
96+
97+ error: diagnostic code `clippy::foo_functions` not found on line 23
98+ --> tests/ui/foo_functions.rs:24:6
99+ |
100+ 24 | //~^ foo_functions
101+ | ^^^^^^^^^^^^^ expected because of this pattern
102+ |
103+
82104```
83105
84106This is normal. After all, we wrote a bunch of Rust code but we haven't really
0 commit comments