How to run Cargo in a nested folder

This article was published on Apr 18, 2021, and takes less than a minute to read.

Let's say you have the following folder structure:

.
├── exercise
└── variables
    ├── Cargo.lock
    ├── Cargo.toml
    └── src
        └── main.rs

You're in root level and wants to run Cargo for variables folder. All you need to do is specifying --manifest-path:

cargo run --manifest-path variables/Cargo.toml