about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2019-09-24 18:24:45 -0400
committerMark Rousskov <mark.simulacrum@gmail.com>2019-10-17 19:16:41 -0400
commit2121b04751702359f3bf03847040a9907ec2f66f (patch)
treed7d4bc5d40822bbd4fcb245144803c28f23cb844
parent577d442fe8337338b873d3df1ab5132de6a1af83 (diff)
downloadrust-2121b04751702359f3bf03847040a9907ec2f66f.tar.gz
rust-2121b04751702359f3bf03847040a9907ec2f66f.zip
Handle lints, not passes in push_lints
This extracts the call to get_lints() to callers.
-rw-r--r--src/librustc/lint/context.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs
index dc16de822eb..c21c45b759c 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<P: LintPass + ?Sized + 'static>(&mut self,
-                                        from_plugin: bool,
-                                        pass: &Box<P>) {
-        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);