Skip to content

Commit 05b323b

Browse files
committed
Add test for lint redundant-self
1 parent 8ca15c0 commit 05b323b

3 files changed

Lines changed: 616 additions & 0 deletions

File tree

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
error: imports need to be explicitly named
2+
--> $DIR/lint-redundant-self.rs:9:24
3+
|
4+
LL | pub use crate::self;
5+
| ^^^^
6+
|
7+
help: try renaming it with a name
8+
|
9+
LL | pub use crate::self as name;
10+
| +++++++
11+
12+
error: imports need to be explicitly named
13+
--> $DIR/lint-redundant-self.rs:13:25
14+
|
15+
LL | pub use crate::{self};
16+
| ^^^^
17+
|
18+
help: try renaming it with a name
19+
|
20+
LL | pub use crate::{self as name};
21+
| +++++++
22+
23+
error: imports need to be explicitly named
24+
--> $DIR/lint-redundant-self.rs:15:25
25+
|
26+
LL | pub use crate::{self, x as x1};
27+
| ^^^^
28+
|
29+
help: try renaming it with a name
30+
|
31+
LL | pub use crate::{self as name, x as x1};
32+
| +++++++
33+
34+
error: imports need to be explicitly named
35+
--> $DIR/lint-redundant-self.rs:20:17
36+
|
37+
LL | pub use self;
38+
| ^^^^
39+
|
40+
help: try renaming it with a name
41+
|
42+
LL | pub use self as name;
43+
| +++++++
44+
45+
error: imports need to be explicitly named
46+
--> $DIR/lint-redundant-self.rs:22:18
47+
|
48+
LL | pub use {self};
49+
| ^^^^
50+
|
51+
help: try renaming it with a name
52+
|
53+
LL | pub use {self as name};
54+
| +++++++
55+
56+
error: imports need to be explicitly named
57+
--> $DIR/lint-redundant-self.rs:26:24
58+
|
59+
LL | pub use self::{self};
60+
| ^^^^
61+
|
62+
help: try renaming it with a name
63+
|
64+
LL | pub use self::{self as name};
65+
| +++++++
66+
67+
error: imports need to be explicitly named
68+
--> $DIR/lint-redundant-self.rs:28:24
69+
|
70+
LL | pub use self::{self, yy as yy1};
71+
| ^^^^
72+
|
73+
help: try renaming it with a name
74+
|
75+
LL | pub use self::{self as name, yy as yy1};
76+
| +++++++
77+
78+
error: imports need to be explicitly named
79+
--> $DIR/lint-redundant-self.rs:33:24
80+
|
81+
LL | pub use super::self;
82+
| ^^^^
83+
|
84+
help: try renaming it with a name
85+
|
86+
LL | pub use super::self as name;
87+
| +++++++
88+
89+
error: imports need to be explicitly named
90+
--> $DIR/lint-redundant-self.rs:37:25
91+
|
92+
LL | pub use super::{self};
93+
| ^^^^
94+
|
95+
help: try renaming it with a name
96+
|
97+
LL | pub use super::{self as name};
98+
| +++++++
99+
100+
error: imports need to be explicitly named
101+
--> $DIR/lint-redundant-self.rs:39:25
102+
|
103+
LL | pub use super::{self, z as z1};
104+
| ^^^^
105+
|
106+
help: try renaming it with a name
107+
|
108+
LL | pub use super::{self as name, z as z1};
109+
| +++++++
110+
111+
error: imports need to be explicitly named
112+
--> $DIR/lint-redundant-self.rs:55:19
113+
|
114+
LL | pub use ::self;
115+
| ^^^^
116+
|
117+
help: try renaming it with a name
118+
|
119+
LL | pub use ::self as name;
120+
| +++++++
121+
122+
error: imports need to be explicitly named
123+
--> $DIR/lint-redundant-self.rs:58:20
124+
|
125+
LL | pub use ::{self};
126+
| ^^^^
127+
|
128+
help: try renaming it with a name
129+
|
130+
LL | pub use ::{self as name};
131+
| +++++++
132+
133+
error[E0252]: the name `x` is defined multiple times
134+
--> $DIR/lint-redundant-self.rs:48:28
135+
|
136+
LL | pub use crate::x::self;
137+
| -------------- previous import of the module `x` here
138+
...
139+
LL | pub use crate::x::{self};
140+
| -------------------^^^^--
141+
| | |
142+
| | `x` reimported here
143+
| help: remove unnecessary import
144+
|
145+
= note: `x` must be defined only once in the type namespace of this module
146+
147+
error[E0252]: the name `x` is defined multiple times
148+
--> $DIR/lint-redundant-self.rs:50:28
149+
|
150+
LL | pub use crate::x::self;
151+
| -------------- previous import of the module `x` here
152+
...
153+
LL | pub use crate::x::{self, z as z3};
154+
| ^^^^--
155+
| |
156+
| `x` reimported here
157+
| help: remove unnecessary import
158+
|
159+
= note: `x` must be defined only once in the type namespace of this module
160+
161+
error: unnecessary `self`
162+
--> $DIR/lint-redundant-self.rs:9:24
163+
|
164+
LL | pub use crate::self;
165+
| --^^^^
166+
| |
167+
| help: consider removing this
168+
|
169+
note: the lint level is defined here
170+
--> $DIR/lint-redundant-self.rs:5:9
171+
|
172+
LL | #![deny(redundant_self)]
173+
| ^^^^^^^^^^^^^^
174+
175+
error: unnecessary `self`
176+
--> $DIR/lint-redundant-self.rs:11:24
177+
|
178+
LL | pub use crate::self as crate1;
179+
| --^^^^
180+
| |
181+
| help: consider removing this
182+
183+
error: unnecessary `self`
184+
--> $DIR/lint-redundant-self.rs:13:25
185+
|
186+
LL | pub use crate::{self};
187+
| ---^^^^- help: consider removing this
188+
189+
error: unnecessary `self`
190+
--> $DIR/lint-redundant-self.rs:16:25
191+
|
192+
LL | pub use crate::{self as crate2};
193+
| ---^^^^----------- help: consider replacing this with: `as crate2`
194+
195+
error: unnecessary `self`
196+
--> $DIR/lint-redundant-self.rs:24:23
197+
|
198+
LL | pub use self::self as self3;
199+
| --^^^^
200+
| |
201+
| help: consider removing this
202+
203+
error: unnecessary `self`
204+
--> $DIR/lint-redundant-self.rs:26:24
205+
|
206+
LL | pub use self::{self};
207+
| ---^^^^- help: consider removing this
208+
209+
error: unnecessary `self`
210+
--> $DIR/lint-redundant-self.rs:29:24
211+
|
212+
LL | pub use self::{self as self4};
213+
| ---^^^^---------- help: consider replacing this with: `as self4`
214+
215+
error: unnecessary `self`
216+
--> $DIR/lint-redundant-self.rs:33:24
217+
|
218+
LL | pub use super::self;
219+
| --^^^^
220+
| |
221+
| help: consider removing this
222+
223+
error: unnecessary `self`
224+
--> $DIR/lint-redundant-self.rs:35:24
225+
|
226+
LL | pub use super::self as super1;
227+
| --^^^^
228+
| |
229+
| help: consider removing this
230+
231+
error: unnecessary `self`
232+
--> $DIR/lint-redundant-self.rs:37:25
233+
|
234+
LL | pub use super::{self};
235+
| ---^^^^- help: consider removing this
236+
237+
error: unnecessary `self`
238+
--> $DIR/lint-redundant-self.rs:40:25
239+
|
240+
LL | pub use super::{self as super2};
241+
| ---^^^^----------- help: consider replacing this with: `as super2`
242+
243+
error: unnecessary `self`
244+
--> $DIR/lint-redundant-self.rs:44:27
245+
|
246+
LL | pub use crate::x::self;
247+
| --^^^^
248+
| |
249+
| help: consider removing this
250+
251+
error: unnecessary `self`
252+
--> $DIR/lint-redundant-self.rs:46:27
253+
|
254+
LL | pub use crate::x::self as x3;
255+
| --^^^^
256+
| |
257+
| help: consider removing this
258+
259+
error: unnecessary `self`
260+
--> $DIR/lint-redundant-self.rs:48:28
261+
|
262+
LL | pub use crate::x::{self};
263+
| ---^^^^- help: consider removing this
264+
265+
error: unnecessary `self`
266+
--> $DIR/lint-redundant-self.rs:51:28
267+
|
268+
LL | pub use crate::x::{self as x4};
269+
| ---^^^^------- help: consider replacing this with: `as x4`
270+
271+
error: aborting due to 29 previous errors
272+
273+
For more information about this error, try `rustc --explain E0252`.

0 commit comments

Comments
 (0)