about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSeo Sanghyeon <sanxiyn@gmail.com>2016-04-04 20:32:42 +0900
committerSeo Sanghyeon <sanxiyn@gmail.com>2016-04-04 20:32:42 +0900
commita09a3acbbd31fe3ea1c11938b6958d87f6096810 (patch)
tree5c85f43cdf64e30dc931e62de954a42e6636cb6f /src
parentf92ce2e9fe56942e0fd6a18d0e11bc4a9bdf8ddd (diff)
downloadrust-a09a3acbbd31fe3ea1c11938b6958d87f6096810.tar.gz
rust-a09a3acbbd31fe3ea1c11938b6958d87f6096810.zip
Remove outdated comment
Diffstat (limited to 'src')
-rw-r--r--src/librustc_resolve/check_unused.rs25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/librustc_resolve/check_unused.rs b/src/librustc_resolve/check_unused.rs
index ea197109cab..19a8f9ec5e8 100644
--- a/src/librustc_resolve/check_unused.rs
+++ b/src/librustc_resolve/check_unused.rs
@@ -51,16 +51,8 @@ impl<'a, 'b, 'tcx:'b> DerefMut for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
 
 impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> {
     // We have information about whether `use` (import) directives are actually
-    // used now. If an import is not used at all, we signal a lint error. If an
-    // import is only used for a single namespace, we remove the other namespace
-    // from the recorded privacy information. That means in privacy.rs, we will
-    // only check imports and namespaces which are used. In particular, this
-    // means that if an import could name either a public or private item, we
-    // will check the correct thing, dependent on how the import is used.
-    fn finalize_import(&mut self, id: ast::NodeId, span: Span) {
-        debug!("finalizing import uses for {:?}",
-               self.session.codemap().span_to_snippet(span));
-
+    // used now. If an import is not used at all, we signal a lint error.
+    fn check_import(&mut self, id: ast::NodeId, span: Span) {
         if !self.used_imports.contains(&(id, TypeNS)) &&
            !self.used_imports.contains(&(id, ValueNS)) {
             self.session.add_lint(lint::builtin::UNUSED_IMPORTS,
@@ -95,23 +87,16 @@ impl<'a, 'b, 'v, 'tcx> Visitor<'v> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
             hir::ItemUse(ref p) => {
                 match p.node {
                     ViewPathSimple(_, _) => {
-                        self.finalize_import(item.id, p.span)
+                        self.check_import(item.id, p.span)
                     }
 
                     ViewPathList(_, ref list) => {
                         for i in list {
-                            self.finalize_import(i.node.id(), i.span);
+                            self.check_import(i.node.id(), i.span);
                         }
                     }
                     ViewPathGlob(_) => {
-                        if !self.used_imports.contains(&(item.id, TypeNS)) &&
-                           !self.used_imports.contains(&(item.id, ValueNS)) {
-                            self.session
-                                .add_lint(lint::builtin::UNUSED_IMPORTS,
-                                          item.id,
-                                          p.span,
-                                          "unused import".to_string());
-                        }
+                        self.check_import(item.id, p.span)
                     }
                 }
             }