Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

No autocomplete for Rng trait on rand::thread_rng() #938

Closed
KevinKoetz opened this issue Jan 24, 2022 · 2 comments
Closed

No autocomplete for Rng trait on rand::thread_rng() #938

KevinKoetz opened this issue Jan 24, 2022 · 2 comments

Comments

@KevinKoetz
Copy link

Trying to follow the rust-book guide, i noticed that there is no autocomplete for the Rng trait on the generator returned by rand::thread_rng().

I get autocompletion for the RngCore trait, but for none of the other traits.

My code:

use rand::Rng;

fn main() {
    let rnd = rand::thread_rng(). //Expecting autocompletion for gen_range() here
    //manually typing "let rnd = rand::thread_rng().gen_range(1..101)" compiles and runs fine.
    println!("rnd: {}", rnd)
}

Cargo.toml

[package]
name = "guessing_game"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rand = "0.8.3"

Installed Version of rust-lang.rust vs-code extension:
0.7.8

rustup component list --installed:

cargo-x86_64-pc-windows-msvc
clippy-x86_64-pc-windows-msvc
rls-x86_64-pc-windows-msvc
rust-analysis-x86_64-pc-windows-msvc
rust-docs-x86_64-pc-windows-msvc
rust-src
rust-std-x86_64-pc-windows-msvc
rustc-x86_64-pc-windows-msvc
rustfmt-x86_64-pc-windows-msvc
@lnicola
Copy link
Member

lnicola commented Jan 24, 2022

I suggest you try https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer instead (because of a Code bug you'll get an older version unless you opt in to the pre-release ones). Completion works in this specific case:

image

CC #927

@KevinKoetz
Copy link
Author

Thank you very much. Solved the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants