Rust-clippy: wildcard_imports lint is triggered in a test module

Created on 3 Jul 2020  路  3Comments  路  Source: rust-lang/rust-clippy

As far as I can see, wildcard_imports should ignore wildcard imports in test modules, but it gives an error in the following core:

#[cfg(test)]
mod tests {
    use super::*;
    use crate::compaction_filter::Decision;
    use crate::{Options, DB};
    use std::ffi::CString;

Unfortunately, I was unable to create a minimal example: Clippy works as expected in all other projects. I would be glad to hear any suggestions on how to fix it.

The issue is in this pull request: https://github.com/rust-rocksdb/rust-rocksdb/pull/441/files#diff-6f1fec81dab2dad1ae2f465dd9dd373bR77
Build log: https://travis-ci.org/github/rust-rocksdb/rust-rocksdb/jobs/704712608#L202

Meta

  • cargo clippy -V: clippy 0.0.212 (d4092ac 2020-05-11)
  • rustc -Vv:
    rustc 1.44.0 (49cae5576 2020-06-01) binary: rustc commit-hash: 49cae55760da0a43428eba73abcb659bb70cf2e4 commit-date: 2020-06-01 host: x86_64-unknown-linux-gnu release: 1.44.0 LLVM version: 9.0
L-bug

Most helpful comment

This was already fixed in https://github.com/rust-lang/rust-clippy/pull/5564, but didn't hit stable yet. It should be included in the next stable Clippy release Thursday next week.

All 3 comments

This was already fixed in https://github.com/rust-lang/rust-clippy/pull/5564, but didn't hit stable yet. It should be included in the next stable Clippy release Thursday next week.

Even better, if you want the lint extra pedantic, there is now a configuration flag. But for tests this lint is disabled by default. Documentation

@flip1995 I will wait for the next release, thanks for the quick reply!

I have seen warn-on-all-wildcard-imports in the documentation, but as you said, it is disabled by default and I don't want to turn it on, because use super::* is very convenient in the tests.

Was this page helpful?
0 / 5 - 0 ratings