Skip to content

Rust 2018: cargo fix doesn't remove extern crate #53922

Closed
@Procrat

Description

@Procrat

From what I read in the edition guide, extern crate is now redundant. cargo fix didn't remove these statements however, causing the following two errors after switching to Rust 2018 (with uniform paths):

error: `chrono` import is ambiguous
  --> src/...
   |
5  | extern crate chrono;
   | -------------------- can refer to `self::chrono`
...
47 | use chrono::prelude::*;
   |     ^^^^^^ can refer to external crate `::chrono`
   |
   = help: write `::chrono` or `self::chrono` explicitly instead
   = note: relative `use` paths enabled by `#![feature(uniform_paths)]`

The second error I got feels like it should have been a warning:

error: `take_mut` import is redundant
 --> src/...
  |
8 | use take_mut;
  |     ^^^^^^^^
  |     |
  |     refers to external crate `::take_mut`
  |     defines `self::take_mut`, shadowing itself
  |
  = help: remove or write `::take_mut` explicitly instead
  = note: relative `use` paths enabled by `#![feature(uniform_paths)]`

cargo fix should probably also remove these redundant use statements?

Given some pointers, I'm happy to take a look at both/either this issue and/or the other one I filed!

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