Skip to content

Commit 2121b04

Browse files
Handle lints, not passes in push_lints
This extracts the call to get_lints() to callers.
1 parent 577d442 commit 2121b04

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/librustc/lint/context.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl LintStore {
172172
from_plugin: bool,
173173
register_only: bool,
174174
pass: EarlyLintPassObject) {
175-
self.push_pass(from_plugin, &pass);
175+
self.push_lints(from_plugin, &pass.get_lints());
176176
if !register_only {
177177
self.early_passes.as_mut().unwrap().push(pass);
178178
}
@@ -184,7 +184,7 @@ impl LintStore {
184184
register_only: bool,
185185
pass: EarlyLintPassObject,
186186
) {
187-
self.push_pass(from_plugin, &pass);
187+
self.push_lints(from_plugin, &pass.get_lints());
188188
if !register_only {
189189
self.pre_expansion_passes.as_mut().unwrap().push(pass);
190190
}
@@ -195,7 +195,7 @@ impl LintStore {
195195
register_only: bool,
196196
per_module: bool,
197197
pass: LateLintPassObject) {
198-
self.push_pass(from_plugin, &pass);
198+
self.push_lints(from_plugin, &pass.get_lints());
199199
if !register_only {
200200
if per_module {
201201
self.late_module_passes.push(pass);
@@ -206,10 +206,8 @@ impl LintStore {
206206
}
207207

208208
// Helper method for register_early/late_pass
209-
fn push_pass<P: LintPass + ?Sized + 'static>(&mut self,
210-
from_plugin: bool,
211-
pass: &Box<P>) {
212-
for lint in pass.get_lints() {
209+
fn push_lints(&mut self, from_plugin: bool, lints: &[&'static Lint]) {
210+
for lint in lints {
213211
self.lints.push((lint, from_plugin));
214212

215213
let id = LintId::of(lint);

0 commit comments

Comments
 (0)