Rust Random number use rand::Rng; not implement error my VS Code

It is worked :innocent: :star_struck:

Simple solution thank you bro.

The issue is you are trying to run the code from algorithm folder in rust all subfolder must have a file that expose them to the public so structure ur file correctly and your issue will be fixed

If you structure your file correctly it would be fixed and if you will like to have your outside the src folder you can customize the path in cargo.toml file

default-run = "ex-two"

name = "ex-two"
path = "path to the ex-two file"

With this configuration when you run cargo run cargo will run the ex-two file note there must be main function inside it if you dont want to make it default or you have another bin you can simply pass --bin ex-two when running cargo if you have further issue you can send me hi on twitter @Mwestmond im glad to help anytime

1 Like

As for my personal setup suggestions, I don’t enjoy all of the “inlay hints” that Rust analyzer provides (type signatures on variables and iterator chains, names of function arguments, etc), so I toggle off some of them in the settings. Also, it’s possible to change the “check command” setting from “check” to “clippy” if you enjoy getting more compiler feedback and tips by default in vscode from the linter clippy.

I also personally enjoy using a terminal-based watch tool next to my IDE to always see full compiler error messages when I want to. I love the tool bacon for that, feel free to check that one out and try it if you’re interested. It also has a command line option “bacon clippy” to run clippy and give not just the cargo check errors and warnings.

If you want to keep tools installed via cargo install up to date, I can also recommend the tool “cargo-update”.


Thank you bro :handshake:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.