Skip to content

Commit 157e797

Browse files
committed
Fix rebase fallout
1 parent a2a8c44 commit 157e797

File tree

5 files changed

+54
-75
lines changed

5 files changed

+54
-75
lines changed

src/librustc/lint/internal.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
1-
// Copyright 2012-2018 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-
111
//! Some lints that are only useful in the compiler or crates that use compiler internals, such as
122
//! Clippy.
133
14-
use errors::Applicability;
15-
use hir::{Expr, ExprKind, PatKind, Path, QPath, Ty, TyKind};
16-
use lint::{
4+
use crate::hir::{Expr, ExprKind, PatKind, Path, QPath, Ty, TyKind};
5+
use crate::lint::{
176
EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintArray, LintContext, LintPass,
187
};
8+
use errors::Applicability;
199
use rustc_data_structures::fx::FxHashMap;
2010
use syntax::ast::Ident;
2111

@@ -42,6 +32,10 @@ impl LintPass for DefaultHashTypes {
4232
fn get_lints(&self) -> LintArray {
4333
lint_array!(DEFAULT_HASH_TYPES)
4434
}
35+
36+
fn name(&self) -> &'static str {
37+
"DefaultHashTypes"
38+
}
4539
}
4640

4741
impl EarlyLintPass for DefaultHashTypes {
@@ -53,7 +47,7 @@ impl EarlyLintPass for DefaultHashTypes {
5347
replace, ident_string
5448
);
5549
let mut db = cx.struct_span_lint(DEFAULT_HASH_TYPES, ident.span, &msg);
56-
db.span_suggestion_with_applicability(
50+
db.span_suggestion(
5751
ident.span,
5852
"use",
5953
replace.to_string(),
@@ -80,6 +74,10 @@ impl LintPass for TyKindUsage {
8074
fn get_lints(&self) -> LintArray {
8175
lint_array!(USAGE_OF_TY_TYKIND)
8276
}
77+
78+
fn name(&self) -> &'static str {
79+
"TyKindUsage"
80+
}
8381
}
8482

8583
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TyKindUsage {
@@ -124,12 +122,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TyKindUsage {
124122
path.span,
125123
"usage of `ty::TyKind::<kind>`",
126124
)
127-
.span_suggestion_with_applicability(
125+
.span_suggestion(
128126
path.span,
129127
"try using ty::<kind> directly",
130128
"ty".to_string(),
131129
Applicability::MaybeIncorrect, // ty maybe needs an import
132-
).emit();
130+
)
131+
.emit();
133132
}
134133
}
135134
}

src/test/ui-fulldeps/internal-lints/default_hash_types.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
// Copyright 2018 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-
111
// compile-flags: -Z internal-lints
122

133
#![feature(rustc_private)]

src/test/ui-fulldeps/internal-lints/default_hash_types.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: Prefer FxHashMap over HashMap, it has better performance
2-
--> $DIR/default_hash_types.rs:18:24
2+
--> $DIR/default_hash_types.rs:8:24
33
|
44
LL | use std::collections::{HashMap, HashSet};
55
| ^^^^^^^ help: use: `FxHashMap`
@@ -8,44 +8,44 @@ LL | use std::collections::{HashMap, HashSet};
88
= note: a `use rustc_data_structures::fx::FxHashMap` may be necessary
99

1010
warning: Prefer FxHashSet over HashSet, it has better performance
11-
--> $DIR/default_hash_types.rs:18:33
11+
--> $DIR/default_hash_types.rs:8:33
1212
|
1313
LL | use std::collections::{HashMap, HashSet};
1414
| ^^^^^^^ help: use: `FxHashSet`
1515
|
1616
= note: a `use rustc_data_structures::fx::FxHashSet` may be necessary
1717

1818
error: Prefer FxHashMap over HashMap, it has better performance
19-
--> $DIR/default_hash_types.rs:24:15
19+
--> $DIR/default_hash_types.rs:14:15
2020
|
2121
LL | let _map: HashMap<String, String> = HashMap::default();
2222
| ^^^^^^^ help: use: `FxHashMap`
2323
|
2424
note: lint level defined here
25-
--> $DIR/default_hash_types.rs:22:8
25+
--> $DIR/default_hash_types.rs:12:8
2626
|
2727
LL | #[deny(default_hash_types)]
2828
| ^^^^^^^^^^^^^^^^^^
2929
= note: a `use rustc_data_structures::fx::FxHashMap` may be necessary
3030

3131
error: Prefer FxHashMap over HashMap, it has better performance
32-
--> $DIR/default_hash_types.rs:24:41
32+
--> $DIR/default_hash_types.rs:14:41
3333
|
3434
LL | let _map: HashMap<String, String> = HashMap::default();
3535
| ^^^^^^^ help: use: `FxHashMap`
3636
|
3737
= note: a `use rustc_data_structures::fx::FxHashMap` may be necessary
3838

3939
error: Prefer FxHashSet over HashSet, it has better performance
40-
--> $DIR/default_hash_types.rs:27:15
40+
--> $DIR/default_hash_types.rs:17:15
4141
|
4242
LL | let _set: HashSet<String> = HashSet::default();
4343
| ^^^^^^^ help: use: `FxHashSet`
4444
|
4545
= note: a `use rustc_data_structures::fx::FxHashSet` may be necessary
4646

4747
error: Prefer FxHashSet over HashSet, it has better performance
48-
--> $DIR/default_hash_types.rs:27:33
48+
--> $DIR/default_hash_types.rs:17:33
4949
|
5050
LL | let _set: HashSet<String> = HashSet::default();
5151
| ^^^^^^^ help: use: `FxHashSet`

src/test/ui-fulldeps/internal-lints/ty_tykind_usage.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
// Copyright 2018 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-
111
// compile-flags: -Z internal-lints
122

133
#![feature(rustc_private)]

src/test/ui-fulldeps/internal-lints/ty_tykind_usage.stderr

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,191 +1,191 @@
11
error: usage of `ty::TyKind::<kind>`
2-
--> $DIR/ty_tykind_usage.rs:21:15
2+
--> $DIR/ty_tykind_usage.rs:11:15
33
|
44
LL | let sty = TyKind::Bool; //~ ERROR usage of `ty::TyKind::<kind>`
55
| ^^^^^^ help: try using ty::<kind> directly: `ty`
66
|
77
note: lint level defined here
8-
--> $DIR/ty_tykind_usage.rs:19:8
8+
--> $DIR/ty_tykind_usage.rs:9:8
99
|
1010
LL | #[deny(usage_of_ty_tykind)]
1111
| ^^^^^^^^^^^^^^^^^^
1212

1313
error: usage of `ty::TyKind::<kind>`
14-
--> $DIR/ty_tykind_usage.rs:24:9
14+
--> $DIR/ty_tykind_usage.rs:14:9
1515
|
1616
LL | TyKind::Bool => (), //~ ERROR usage of `ty::TyKind::<kind>`
1717
| ^^^^^^ help: try using ty::<kind> directly: `ty`
1818

1919
error: usage of `ty::TyKind::<kind>`
20-
--> $DIR/ty_tykind_usage.rs:25:9
20+
--> $DIR/ty_tykind_usage.rs:15:9
2121
|
2222
LL | TyKind::Char => (), //~ ERROR usage of `ty::TyKind::<kind>`
2323
| ^^^^^^ help: try using ty::<kind> directly: `ty`
2424

2525
error: usage of `ty::TyKind::<kind>`
26-
--> $DIR/ty_tykind_usage.rs:26:9
26+
--> $DIR/ty_tykind_usage.rs:16:9
2727
|
2828
LL | TyKind::Int(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
2929
| ^^^^^^ help: try using ty::<kind> directly: `ty`
3030

3131
error: usage of `ty::TyKind::<kind>`
32-
--> $DIR/ty_tykind_usage.rs:27:9
32+
--> $DIR/ty_tykind_usage.rs:17:9
3333
|
3434
LL | TyKind::Uint(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
3535
| ^^^^^^ help: try using ty::<kind> directly: `ty`
3636

3737
error: usage of `ty::TyKind::<kind>`
38-
--> $DIR/ty_tykind_usage.rs:28:9
38+
--> $DIR/ty_tykind_usage.rs:18:9
3939
|
4040
LL | TyKind::Float(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
4141
| ^^^^^^ help: try using ty::<kind> directly: `ty`
4242

4343
error: usage of `ty::TyKind::<kind>`
44-
--> $DIR/ty_tykind_usage.rs:29:9
44+
--> $DIR/ty_tykind_usage.rs:19:9
4545
|
4646
LL | TyKind::Adt(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
4747
| ^^^^^^ help: try using ty::<kind> directly: `ty`
4848

4949
error: usage of `ty::TyKind::<kind>`
50-
--> $DIR/ty_tykind_usage.rs:30:9
50+
--> $DIR/ty_tykind_usage.rs:20:9
5151
|
5252
LL | TyKind::Foreign(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
5353
| ^^^^^^ help: try using ty::<kind> directly: `ty`
5454

5555
error: usage of `ty::TyKind::<kind>`
56-
--> $DIR/ty_tykind_usage.rs:31:9
56+
--> $DIR/ty_tykind_usage.rs:21:9
5757
|
5858
LL | TyKind::Str => (), //~ ERROR usage of `ty::TyKind::<kind>`
5959
| ^^^^^^ help: try using ty::<kind> directly: `ty`
6060

6161
error: usage of `ty::TyKind::<kind>`
62-
--> $DIR/ty_tykind_usage.rs:32:9
62+
--> $DIR/ty_tykind_usage.rs:22:9
6363
|
6464
LL | TyKind::Array(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
6565
| ^^^^^^ help: try using ty::<kind> directly: `ty`
6666

6767
error: usage of `ty::TyKind::<kind>`
68-
--> $DIR/ty_tykind_usage.rs:33:9
68+
--> $DIR/ty_tykind_usage.rs:23:9
6969
|
7070
LL | TyKind::Slice(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
7171
| ^^^^^^ help: try using ty::<kind> directly: `ty`
7272

7373
error: usage of `ty::TyKind::<kind>`
74-
--> $DIR/ty_tykind_usage.rs:34:9
74+
--> $DIR/ty_tykind_usage.rs:24:9
7575
|
7676
LL | TyKind::RawPtr(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
7777
| ^^^^^^ help: try using ty::<kind> directly: `ty`
7878

7979
error: usage of `ty::TyKind::<kind>`
80-
--> $DIR/ty_tykind_usage.rs:35:9
80+
--> $DIR/ty_tykind_usage.rs:25:9
8181
|
8282
LL | TyKind::Ref(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
8383
| ^^^^^^ help: try using ty::<kind> directly: `ty`
8484

8585
error: usage of `ty::TyKind::<kind>`
86-
--> $DIR/ty_tykind_usage.rs:36:9
86+
--> $DIR/ty_tykind_usage.rs:26:9
8787
|
8888
LL | TyKind::FnDef(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
8989
| ^^^^^^ help: try using ty::<kind> directly: `ty`
9090

9191
error: usage of `ty::TyKind::<kind>`
92-
--> $DIR/ty_tykind_usage.rs:37:9
92+
--> $DIR/ty_tykind_usage.rs:27:9
9393
|
9494
LL | TyKind::FnPtr(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
9595
| ^^^^^^ help: try using ty::<kind> directly: `ty`
9696

9797
error: usage of `ty::TyKind::<kind>`
98-
--> $DIR/ty_tykind_usage.rs:38:9
98+
--> $DIR/ty_tykind_usage.rs:28:9
9999
|
100100
LL | TyKind::Dynamic(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
101101
| ^^^^^^ help: try using ty::<kind> directly: `ty`
102102

103103
error: usage of `ty::TyKind::<kind>`
104-
--> $DIR/ty_tykind_usage.rs:39:9
104+
--> $DIR/ty_tykind_usage.rs:29:9
105105
|
106106
LL | TyKind::Closure(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
107107
| ^^^^^^ help: try using ty::<kind> directly: `ty`
108108

109109
error: usage of `ty::TyKind::<kind>`
110-
--> $DIR/ty_tykind_usage.rs:40:9
110+
--> $DIR/ty_tykind_usage.rs:30:9
111111
|
112112
LL | TyKind::Generator(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
113113
| ^^^^^^ help: try using ty::<kind> directly: `ty`
114114

115115
error: usage of `ty::TyKind::<kind>`
116-
--> $DIR/ty_tykind_usage.rs:41:9
116+
--> $DIR/ty_tykind_usage.rs:31:9
117117
|
118118
LL | TyKind::GeneratorWitness(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
119119
| ^^^^^^ help: try using ty::<kind> directly: `ty`
120120

121121
error: usage of `ty::TyKind::<kind>`
122-
--> $DIR/ty_tykind_usage.rs:42:9
122+
--> $DIR/ty_tykind_usage.rs:32:9
123123
|
124124
LL | TyKind::Never => (), //~ ERROR usage of `ty::TyKind::<kind>`
125125
| ^^^^^^ help: try using ty::<kind> directly: `ty`
126126

127127
error: usage of `ty::TyKind::<kind>`
128-
--> $DIR/ty_tykind_usage.rs:43:9
128+
--> $DIR/ty_tykind_usage.rs:33:9
129129
|
130130
LL | TyKind::Tuple(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
131131
| ^^^^^^ help: try using ty::<kind> directly: `ty`
132132

133133
error: usage of `ty::TyKind::<kind>`
134-
--> $DIR/ty_tykind_usage.rs:44:9
134+
--> $DIR/ty_tykind_usage.rs:34:9
135135
|
136136
LL | TyKind::Projection(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
137137
| ^^^^^^ help: try using ty::<kind> directly: `ty`
138138

139139
error: usage of `ty::TyKind::<kind>`
140-
--> $DIR/ty_tykind_usage.rs:45:9
140+
--> $DIR/ty_tykind_usage.rs:35:9
141141
|
142142
LL | TyKind::UnnormalizedProjection(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
143143
| ^^^^^^ help: try using ty::<kind> directly: `ty`
144144

145145
error: usage of `ty::TyKind::<kind>`
146-
--> $DIR/ty_tykind_usage.rs:46:9
146+
--> $DIR/ty_tykind_usage.rs:36:9
147147
|
148148
LL | TyKind::Opaque(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
149149
| ^^^^^^ help: try using ty::<kind> directly: `ty`
150150

151151
error: usage of `ty::TyKind::<kind>`
152-
--> $DIR/ty_tykind_usage.rs:47:9
152+
--> $DIR/ty_tykind_usage.rs:37:9
153153
|
154154
LL | TyKind::Param(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
155155
| ^^^^^^ help: try using ty::<kind> directly: `ty`
156156

157157
error: usage of `ty::TyKind::<kind>`
158-
--> $DIR/ty_tykind_usage.rs:48:9
158+
--> $DIR/ty_tykind_usage.rs:38:9
159159
|
160160
LL | TyKind::Bound(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
161161
| ^^^^^^ help: try using ty::<kind> directly: `ty`
162162

163163
error: usage of `ty::TyKind::<kind>`
164-
--> $DIR/ty_tykind_usage.rs:49:9
164+
--> $DIR/ty_tykind_usage.rs:39:9
165165
|
166166
LL | TyKind::Placeholder(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
167167
| ^^^^^^ help: try using ty::<kind> directly: `ty`
168168

169169
error: usage of `ty::TyKind::<kind>`
170-
--> $DIR/ty_tykind_usage.rs:50:9
170+
--> $DIR/ty_tykind_usage.rs:40:9
171171
|
172172
LL | TyKind::Infer(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
173173
| ^^^^^^ help: try using ty::<kind> directly: `ty`
174174

175175
error: usage of `ty::TyKind::<kind>`
176-
--> $DIR/ty_tykind_usage.rs:51:9
176+
--> $DIR/ty_tykind_usage.rs:41:9
177177
|
178178
LL | TyKind::Error => (), //~ ERROR usage of `ty::TyKind::<kind>`
179179
| ^^^^^^ help: try using ty::<kind> directly: `ty`
180180

181181
error: usage of `ty::TyKind::<kind>`
182-
--> $DIR/ty_tykind_usage.rs:56:12
182+
--> $DIR/ty_tykind_usage.rs:46:12
183183
|
184184
LL | if let TyKind::Int(int_ty) = sty {} //~ ERROR usage of `ty::TyKind::<kind>`
185185
| ^^^^^^ help: try using ty::<kind> directly: `ty`
186186

187187
error: usage of `ty::TyKind`
188-
--> $DIR/ty_tykind_usage.rs:58:24
188+
--> $DIR/ty_tykind_usage.rs:48:24
189189
|
190190
LL | fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {} //~ ERROR usage of `ty::TyKind`
191191
| ^^^^^^^^^^

0 commit comments

Comments
 (0)