Skip to content

Removing all unused imports removes used import #18941

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

Closed
justanotheranonymoususer opened this issue Jan 15, 2025 · 6 comments · Fixed by #19088
Closed

Removing all unused imports removes used import #18941

justanotheranonymoususer opened this issue Jan 15, 2025 · 6 comments · Fixed by #19088
Labels
A-assists C-bug Category: bug

Comments

@justanotheranonymoususer

rust-analyzer version: 0.3.2264-standalone (8364ef2 2025-01-12) [c:\Users\User.vscode\extensions\rust-lang.rust-analyzer-0.3.2264-win32-x64\server\rust-analyzer.exe]

rustc version: rustc 1.83.0 (90b35a623 2024-11-26)

editor or extension: VSCode w rust-analyzer v0.3.2264

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

repository link (if public, optional): (eg. rust-analyzer)

code snippet to reproduce:

use std::{
    io::Write,
    str,
};

fn greet(msg: &str) {
    println!("{msg}");
}

fn main() {
    greet(str::from_utf8(b"Hello, world!").unwrap());
}
Code.mp4
@evbo
Copy link

evbo commented Feb 8, 2025

another case that seems consistent:

use bevy_reflect::{List, PartialReflect, Reflect, Struct};

Reflect always gets removed in VS Code when I highlight entire file and remove all unused, even if it is used.

@ChayimFriedman2
Copy link
Contributor

@evbo How is is used?

@evbo
Copy link

evbo commented Feb 8, 2025

Reflect is a Derive macro that you use on a struct:

https://docs.rs/bevy/latest/bevy/prelude/derive.Reflect.html

@ChayimFriedman2
Copy link
Contributor

That looks like a separate issue. Please open a new issue, with reproduction details.

@evbo
Copy link

evbo commented Feb 9, 2025

But the title matches the issue perfectly doesn't it?

@ChayimFriedman2
Copy link
Contributor

Well yes, but having different issues for different problems eases the management of them for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-assists C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants