intellij-rust/intellij-rust.github.io

Automatic import importing wrong things

Jiehong opened this issue · 1 comments

Hi,

With the new semi-auto import feature being there (amazing! thanks!), I tried a quick piece of code, and here are my results:

fn sqr(number: i64) -> i64 {
    thread::sleep(Duration::from_secs(2));
    return number * number;
}

In this code, you'll be able to try to import thread from line thread::sleep. If you do so, the following line will be added:

use std::thread::thread;

While it should be:

use std::thread;

Once you've fixed this import, it seems that you can try to import Duration, but using Alt+Enter only offers you to add parenthesis around the expression.

It should offer to import the following line:

use std::time::Duration;

IDE version: Intellij IDE Community 2017.3.2

Undin commented

This issue was moved to intellij-rust/intellij-rust#2159