rust-lang / rust-lang/rust-clippy

wildcard imports breaks code

Open
#5,227 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

I-suggestion-causes-error
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

clippy 0.0.212 (fc5d0cc 2020-02-24)

I applied the wildcard import lints suggestions but it broke my code inside tests:
I have use library::* here https://github.com/matthiaskrgr/cargo-cache/blob/master/src/dirsizes.rs#L21
and it gets expanded to use crate::library::CargoCachePaths; (lint suggestion).
This however breaks tests where I use use super::*; here: https://github.com/matthiaskrgr/cargo-cache/blob/master/src/dirsizes.rs#L464
and causes DirInfo struct to not be found anymore inside the test. :(

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the wildcard import lint behavior described in src/dirsizes.rs, especially the imports near lines 21 and 464 in the linked cargo-cache example. Reproduce the suggested expansion and inspect how it affects the test's use super::*; done when the lint suggestion no longer causes DirInfo to become unavailable in that test.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.