Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Introduce Constant" inserts a needless "use crate" when extracting to a file scope #5377

Closed
lancelote opened this issue May 14, 2020 · 0 comments · Fixed by #5379
Closed
Assignees
Labels
bug subsystem::refactoring Issues related to refactorings

Comments

@lancelote
Copy link
Member

Environment

  • IntelliJ Rust plugin version: 0.2.123.SNAPSHOT-201-dev
  • Rust toolchain version: 1.43.0 (4fb7144ed 2020-04-20) x86_64-apple-darwin
  • IDE name and version: CLion 2020.1.1 (CL-201.7223.86)
  • Operating system: macOS 10.15.4

Problem description

Trying to introduce a constant (#4985) to a global file scope results in a wild use crate::X and an error:

2020-05-14 22 22 07

Steps to reproduce

fn main() {
    println!("{}", 1 + 1);
}

... call "Introduce Constant" on 1 + 1

use crate::I;

const I: i32 = 1 + 1;

fn main() {
    println!("{}", I);
}
@lancelote lancelote added bug subsystem::refactoring Issues related to refactorings labels May 14, 2020
bors bot added a commit that referenced this issue May 17, 2020
5379: REF: fix auto-import in introduce constant refactoring r=vlad20012 a=Kobzol

Fixes: #5377

Co-authored-by: Jakub Beránek <berykubik@gmail.com>
@bors bors bot closed this as completed in 8f4962a May 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug subsystem::refactoring Issues related to refactorings
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants