Skip to content

unused imports not all detected #16287

Closed
Closed

Description

@bfops

Sorry, I don't have a minimal repro.

The following commit (I believe) has all unused imports removed: bfops/playform@c4f7351.

However, applying the following patch still builds fine, with no unused import warnings or errors:

diff --git a/Cargo.toml b/Cargo.toml
index 3e6910f..2b32761 100755
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,6 +19,9 @@ git = "https://github.com/bjz/gl-rs"
[dependencies.sdl2_game_window]
git = "https://github.com/bfops/sdl2_game_window"

+[dependencies.cgmath]
+git = "https://github.com/bjz/cgmath-rs"
+
[dependencies.piston]
git = "https://github.com/PistonDevelopers/piston"

diff --git a/src/glw.rs b/src/glw.rs
index 56bcd4d..54ae3aa 100644
--- a/src/glw.rs
+++ b/src/glw.rs
@@ -4,6 +4,7 @@
//! GLW stands for "OpenGL wrapper".
+#[deny(unused_imports)]
pub use color::Color4;
+pub use cgmath::matrix::Matrix4;
use cstr_cache;
use libc::types::common::c95;
use nalgebra::na::{Mat3, Mat4, Vec3, Eye, Outer};
diff --git a/src/playform.rs b/src/playform.rs
index c2ef41b..05de4a2 100644
--- a/src/playform.rs
+++ b/src/playform.rs
@@ -10,6 +10,7 @@
// to disable warnings only in a macro.
#![allow(unused_unsafe)]

+extern crate cgmath;
extern crate gl;
extern crate libc;
extern crate nalgebra;

rustc 0.12.0-pre-nightly (25741603f 2014-08-03 23:46:10 +0000)

Activity

  1. alexcrichton commented on Aug 6, 2014

    @alexcrichton
    Member

    The only import you've added here is a pub use which are all whitelisted for unused imports. Is there another specific import you're thinking this should have warned about?

  2. bfops commented on Aug 6, 2014

    @bfops
    ContributorAuthor

    Oh, you're right. I guess I was expecting that something like this would generate at least a warning:

    pub use std::cmp;
    
    pub struct Vec3;
    
    pub fn foo() {}
    
    pub fn main() {
    }
    

    Especially since this does:

    mod test;
    
    pub fn main() {
    }
    

    test.rs:

    pub fn foo () {}
    
  3. alexcrichton commented on Aug 6, 2014

    @alexcrichton
    Member

    Ok, in that case I'm going to close this as intended. Resolve doesn't currently warn about any pub use imports as it's undecided whether they're used because they could later be used by future crates for example.

  4. added a commit that references this issue on Aug 29, 2024
    e2f2e73
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions