From 2121b04751702359f3bf03847040a9907ec2f66f Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Tue, 24 Sep 2019 18:24:45 -0400 Subject: [PATCH] Handle lints, not passes in push_lints This extracts the call to get_lints() to callers. --- src/librustc/lint/context.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index dc16de822ebc..c21c45b759c6 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -172,7 +172,7 @@ impl LintStore { from_plugin: bool, register_only: bool, pass: EarlyLintPassObject) { - self.push_pass(from_plugin, &pass); + self.push_lints(from_plugin, &pass.get_lints()); if !register_only { self.early_passes.as_mut().unwrap().push(pass); } @@ -184,7 +184,7 @@ impl LintStore { register_only: bool, pass: EarlyLintPassObject, ) { - self.push_pass(from_plugin, &pass); + self.push_lints(from_plugin, &pass.get_lints()); if !register_only { self.pre_expansion_passes.as_mut().unwrap().push(pass); } @@ -195,7 +195,7 @@ impl LintStore { register_only: bool, per_module: bool, pass: LateLintPassObject) { - self.push_pass(from_plugin, &pass); + self.push_lints(from_plugin, &pass.get_lints()); if !register_only { if per_module { self.late_module_passes.push(pass); @@ -206,10 +206,8 @@ impl LintStore { } // Helper method for register_early/late_pass - fn push_pass(&mut self, - from_plugin: bool, - pass: &Box

) { - for lint in pass.get_lints() { + fn push_lints(&mut self, from_plugin: bool, lints: &[&'static Lint]) { + for lint in lints { self.lints.push((lint, from_plugin)); let id = LintId::of(lint);