Skip to content

FP single_component_path_imports #5210

Closed
@matthiaskrgr

Description

@matthiaskrgr

clippy 0.0.212 (2855b21 2020-02-19)

Cargo.toml:

...
[dependencies]
crypto-hash = "0.3.1"

main.rs:

use self::crypto_hash::{Algorithm, Hasher};
use crypto_hash;

fn main() {}

This will cause a warning:

warning: this import is redundant
 --> src/main.rs:2:1
  |
2 | use crypto_hash;
  | ^^^^^^^^^^^^^^^^ help: remove it entirely
  |
  = note: `#[warn(clippy::single_component_path_imports)]` on by default

but removing it will lead to a compiler error:

error[E0432]: unresolved import `self::crypto_hash`
 --> src/main.rs:1:11
  |
1 | use self::crypto_hash::{Algorithm, Hasher};
  |           ^^^^^^^^^^^ maybe a missing crate `crypto_hash`?

error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when applied

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions