Unable to get prepackaged Rust to work with VS code

Hi,

I’m trying to get the prepackaged Rust available in the Fedora repos to work with visual studio code but I can’t get the code to run. The code runs on vim but not on visual studio code. I installed the rust-analyser extension but still I don’t see any run button near the main function, nor does running it from the run menu have any effect. If I open the visual studio terminal and try to build using cargo, it says cargo not found. However, cargo builds and runs just fine on vim. It seems like visual studio code is not able to detect the rust package installed on the system? or is it expecting the standardized rustup install?

I would like to know if there’s a way to get it to work with the prepackaged rust rather than rustup since it wil be easier to handle updates using dnf so I prefer not to install the standardized rustup unless I absolutely have to. Any tips on how I can VS code to run rust code using the prepackaged rust?

I installed all the packages corresponding to the prepackaged rust as advised on this post

rust-analyzer output:

2024-05-04T14:52:34.186517Z ERROR rust_analyzer::main_loop: FetchWorkspaceError:
rust-analyzer failed to load workspace: Failed to load the project at /home/lxhome/Lang/Rust/projects/hello_world/hello_world/Cargo.toml: Failed to query rust toolchain version at /home/lxhome/Lang/Rust/projects/hello_world/hello_world, is your toolchain setup correctly?: cd "/home/lxhome/Lang/Rust/projects/hello_world/hello_world" && "cargo" "--version" failed: No such file or directory (os error 2)

2024-05-04T14:52:41.479055Z ERROR rust_analyzer::main_loop: FetchWorkspaceError:
rust-analyzer failed to load workspace: Failed to load the project at /home/lxhome/Lang/Rust/projects/hello_world/hello_world/Cargo.toml: Failed to query rust toolchain version at /home/lxhome/Lang/Rust/projects/hello_world/hello_world, is your toolchain setup correctly?: cd "/home/lxhome/Lang/Rust/projects/hello_world/hello_world" && "cargo" "--version" failed: No such file or directory (os error 2)

and on vim:

lxhome@fedora:~/Lang/Rust/projects/hello_world/hello_world/src$ cargo build
   Compiling hello_world v0.1.0 (/home/lxhome/Lang/Rust/projects/hello_world/hello_world)
    Finished dev [unoptimized + debuginfo] target(s) in 6.38s
lxhome@fedora:~/Lang/Rust/projects/hello_world/hello_world/src$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `/home/lxhome/Lang/Rust/projects/hello_world/hello_world/target/debug/hello_world`
Hello world!
lxhome@fedora:~/Lang/Rust/projects/hello_world/hello_world/src$ 

Thanks
K