1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-12-26 00:11:49 +02:00

Compare commits

..

56 Commits
5.4.0 ... 5.4.1

Author SHA1 Message Date
liv
7f1754ecc5 release: 5.4.1 2023-03-10 17:39:59 +01:00
liv
e4971ec7b3 Merge pull request #1414 from rust-lang/all-contributors/add-MahdiBM
docs: add MahdiBM as a contributor for tool
2023-03-10 17:28:22 +01:00
allcontributors[bot]
ec974f5dac docs: update .all-contributorsrc [skip ci] 2023-03-10 16:28:13 +00:00
allcontributors[bot]
7b2bfda37f docs: update AUTHORS.md [skip ci] 2023-03-10 16:28:12 +00:00
liv
2f34370f2f Merge pull request #1402 from MahdiBM/patch-1
Better error message when failing
2023-03-10 17:27:53 +01:00
liv
94799b1e98 Merge pull request #1413 from rust-lang/all-contributors/add-nidhalmessaoudi
docs: add nidhalmessaoudi as a contributor for code
2023-03-10 11:51:36 +01:00
allcontributors[bot]
d334e0c66c docs: update .all-contributorsrc [skip ci] 2023-03-10 10:51:24 +00:00
allcontributors[bot]
3da5816db2 docs: update AUTHORS.md [skip ci] 2023-03-10 10:51:23 +00:00
liv
c8273e06c6 Merge pull request #1404 from nidhalmessaoudi/master
Always showing correct progress percentages.
2023-03-10 11:51:08 +01:00
liv
ff50159a3d fix: remove repl.it support for now
It stopped working and needs too much manual fixing, until someone
comes along to fix it, it's not great to have in the README section.

Closes #1352.
2023-03-03 21:27:57 +01:00
Nidhal Messaoudi
34aafa82f9 Main exercises 2023-02-27 21:37:25 +01:00
Nidhal Messaoudi
278a1f103b Original exercises 2023-02-27 21:33:28 +01:00
Nidhal Messaoudi
1acbbb6d43 Fixing the progress percentage 2023-02-27 21:17:45 +01:00
Nidhal Messaoudi
e3a20b8bc8 Learning about vectors 2023-02-27 21:16:40 +01:00
Nidhal Messaoudi
f7678b4a9e Learning about primitive data types 2023-02-27 12:57:40 +01:00
Nidhal Messaoudi
52ed5dbcf9 First quiz and its related modules 2023-02-26 17:28:24 +01:00
Mahdi Bahrami
6c5ba7cc01 Better error message when failing 2023-02-26 19:30:57 +03:30
liv
36e66b545e Merge pull request #1396 from 0lhi/main
fix(macros4.rs): Add rustfmt::skip to prevent auto-fix.
2023-02-26 13:10:24 +01:00
liv
0e9966d6a4 Merge pull request #1397 from crd477/patch-1
rustfmt
2023-02-26 13:10:04 +01:00
liv
75fbf7a8f3 Merge pull request #1401 from rust-lang/all-contributors/add-mdmundo
docs: add mdmundo as a contributor for infra
2023-02-26 13:09:26 +01:00
liv
e700a3cc4d Merge branch 'main' into all-contributors/add-mdmundo 2023-02-26 13:09:20 +01:00
allcontributors[bot]
eb7f21df04 docs: update .all-contributorsrc [skip ci] 2023-02-26 12:08:07 +00:00
allcontributors[bot]
ac9c1adb75 docs: update AUTHORS.md [skip ci] 2023-02-26 12:08:06 +00:00
liv
d06f7bf1ff Merge pull request #1400 from rust-lang/all-contributors/add-eroullit
docs: add eroullit as a contributor for infra
2023-02-26 13:07:02 +01:00
allcontributors[bot]
7f06bb5fa7 docs: update AUTHORS.md [skip ci] 2023-02-26 12:06:57 +00:00
allcontributors[bot]
0ad8eec3eb docs: update .all-contributorsrc [skip ci] 2023-02-26 12:06:51 +00:00
allcontributors[bot]
3c841c4685 docs: update AUTHORS.md [skip ci] 2023-02-26 12:06:50 +00:00
liv
d5b647d5ab Merge pull request #1399 from eroullit/codespaces
Codespaces ❤️ Rustlings
2023-02-26 13:05:05 +01:00
Emmanuel Roullit
86f8fa8e6e Update README.md
Fix refs from master to main
2023-02-25 17:57:34 +01:00
Emmanuel Roullit
351e4e2460 Update devcontainer.json 2023-02-25 17:56:00 +01:00
Emmanuel Roullit
1afc7ed8c5 Update README.md
Create Rustlings Codespace in one click
2023-02-25 17:20:31 +01:00
Emmanuel Roullit
fcadbfc70d Merge branch 'rust-lang:main' into codespaces 2023-02-25 17:11:43 +01:00
Chad Dougherty
8c88f769b6 rustfmt
rustfmt converts "main ()" -> "main()"
2023-02-24 08:51:03 -05:00
0lhi
de24536187 macros4.rs: Add rustfmt::skip to prevent auto-fix.
The `macros4.rs` challenge can automatically be solved by rustfmt without the user noticing.

Adding `#[rustfmt::skip]` above the `macro_rules!` line fixes this issue.
2023-02-24 01:43:23 +01:00
liv
701b4bef51 Merge pull request #1386 from cyril-marpaud/cmp_arc1
refactor(arc1): improve readability by avoiding implicit dereference
2023-02-19 12:34:52 +01:00
Cyril MARPAUD
045d86aa42 refactor(arc1): improve readability by avoiding implicit dereference 2023-02-18 21:38:43 +01:00
liv
bec7be05f5 Merge pull request #1383 from rust-lang/all-contributors/add-shgew
docs: add shgew as a contributor for content
2023-02-18 14:26:58 +01:00
allcontributors[bot]
d42ac49de4 docs: update .all-contributorsrc [skip ci] 2023-02-18 13:26:38 +00:00
allcontributors[bot]
1272d0b990 docs: update AUTHORS.md [skip ci] 2023-02-18 13:26:37 +00:00
liv
cf86e734f2 Merge pull request #1381 from shgew/fix/errors5-comment
fix: unify undisclosed type notation in errors5.rs
2023-02-18 14:26:23 +01:00
Gleb Shevchenko
238a496af5 fix: unify undisclosed type notation in errors5.rs 2023-02-18 14:09:04 +01:00
liv
a3670d267b Merge pull request #1380 from rust-lang/all-contributors/add-Anush008
docs: add Anush008 as a contributor for doc
2023-02-17 19:04:09 +01:00
allcontributors[bot]
65f05f0541 docs: update .all-contributorsrc [skip ci] 2023-02-17 18:03:59 +00:00
allcontributors[bot]
338c95f120 docs: update AUTHORS.md [skip ci] 2023-02-17 18:03:58 +00:00
liv
2b9dc4424e Merge pull request #1379 from Anush008/patch-1
Removed verbose instructions from the uninstall section
2023-02-17 19:03:41 +01:00
Anush
ef0b25c392 Removed verbose instructions from the uninstall section 2023-02-17 22:51:42 +05:30
liv
6f0e5d13ed Merge pull request #1372 from rust-lang/all-contributors/add-black-puppydog
docs: add black-puppydog as a contributor for content
2023-02-15 14:17:07 +01:00
allcontributors[bot]
046a18cd16 docs: update .all-contributorsrc [skip ci] 2023-02-15 13:16:59 +00:00
allcontributors[bot]
e1e67d0d41 docs: update AUTHORS.md [skip ci] 2023-02-15 13:16:58 +00:00
liv
216d08d013 Merge pull request #1244 from black-puppydog/cow-rework
refactor(cow1):  replace main with tests
2023-02-15 14:16:22 +01:00
Daan Wynen
bbdc5c6039 refactor(cow1): replace main with tests
Following the discussion in #1195 this is the best I could come up with.
The issue for me (and apparently a few other learners) was that the code
needed to complete the exercise was not _missing_, but was rather there
but wrong.

In the end, what made the difference between this exercise and others
(for me) was that in this exercise I was supposed to learn what to
*expect* of an output. So I think it makes sense here to let the learner
modify the tests and not the code itself.

Fixes #1195

Signed-off-by: Daan Wynen <black.puppydog@gmx.de>

# Conflicts:
#	info.toml
2023-02-14 20:37:33 +01:00
liv
149e0c8ac2 Merge pull request #1370 from magnusrodseth/main
docs: add link to docs about `iter_mut` and `map`
2023-02-13 11:01:48 +01:00
magnusrodseth
48ce9d2fd8 docs: add link to docs about iter_mut and map 2023-02-12 18:26:13 +01:00
Emmanuel Roullit
b653d4848a doc: add hint on how to create codespace
Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
2022-12-01 16:15:13 +01:00
Emmanuel Roullit
4972bede48 dev: source cargo env files to find rustup
Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
2022-12-01 14:30:03 +01:00
Emmanuel Roullit
f94f365e14 dev: add basic devcontainer settings file
Theses settings files are the base needed to declare and
bootstrap development environment on codespaces

Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
2022-12-01 14:15:35 +01:00
19 changed files with 180 additions and 44 deletions

View File

@@ -1839,6 +1839,69 @@
"contributions": [
"content"
]
},
{
"login": "black-puppydog",
"name": "Daan Wynen",
"avatar_url": "https://avatars.githubusercontent.com/u/189241?v=4",
"profile": "https://github.com/black-puppydog",
"contributions": [
"content"
]
},
{
"login": "Anush008",
"name": "Anush",
"avatar_url": "https://avatars.githubusercontent.com/u/46051506?v=4",
"profile": "https://github.com/Anush008",
"contributions": [
"doc"
]
},
{
"login": "shgew",
"name": "Gleb Shevchenko",
"avatar_url": "https://avatars.githubusercontent.com/u/5584672?v=4",
"profile": "https://github.com/shgew",
"contributions": [
"content"
]
},
{
"login": "mdmundo",
"name": "Edmundo Paulino",
"avatar_url": "https://avatars.githubusercontent.com/u/60408300?v=4",
"profile": "https://github.com/mdmundo",
"contributions": [
"infra"
]
},
{
"login": "eroullit",
"name": "Emmanuel Roullit",
"avatar_url": "https://avatars.githubusercontent.com/u/301795?v=4",
"profile": "https://github.com/eroullit",
"contributions": [
"infra"
]
},
{
"login": "nidhalmessaoudi",
"name": "Nidhal Messaoudi",
"avatar_url": "https://avatars.githubusercontent.com/u/63377412?v=4",
"profile": "https://nidhalmessaoudi.herokuapp.com",
"contributions": [
"code"
]
},
{
"login": "MahdiBM",
"name": "Mahdi Bahrami",
"avatar_url": "https://avatars.githubusercontent.com/u/54685446?v=4",
"profile": "https://github.com/MahdiBM",
"contributions": [
"tool"
]
}
],
"contributorsPerLine": 8,

View File

@@ -0,0 +1,17 @@
{
"image": "mcr.microsoft.com/devcontainers/universal:2-linux",
"waitFor": "onCreateCommand",
"onCreateCommand": ".devcontainer/setup.sh",
"updateContentCommand": "cargo build",
"postCreateCommand": "",
"postAttachCommand": {
"server": "rustlings watch"
},
"customizations": {
"vscode": {
"extensions": [
"rust-lang.rust-analyzer"
]
}
}
}

7
.devcontainer/setup.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
curl https://sh.rustup.rs -sSf | sh -s -- -y
# Update current shell environment variables after install to find rustup
. "$HOME/.cargo/env"
rustup install stable
bash install.sh

View File

@@ -1,2 +0,0 @@
language = "rust"
run = "[ -x ~/.cargo/bin/rustlings ] && ~/.cargo/bin/rustlings watch || ./install.sh"

View File

@@ -262,6 +262,13 @@ authors.
</tr>
<tr>
<td align="center" valign="top" width="12.5%"><a href="https://grzegorz-zur.com/"><img src="https://avatars.githubusercontent.com/u/5297583?v=4?s=100" width="100px;" alt="Grzegorz Żur"/><br /><sub><b>Grzegorz Żur</b></sub></a><br /><a href="#content-grzegorz-zur" title="Content">🖋</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/black-puppydog"><img src="https://avatars.githubusercontent.com/u/189241?v=4?s=100" width="100px;" alt="Daan Wynen"/><br /><sub><b>Daan Wynen</b></sub></a><br /><a href="#content-black-puppydog" title="Content">🖋</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/Anush008"><img src="https://avatars.githubusercontent.com/u/46051506?v=4?s=100" width="100px;" alt="Anush"/><br /><sub><b>Anush</b></sub></a><br /><a href="https://github.com/rust-lang/rustlings/commits?author=Anush008" title="Documentation">📖</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/shgew"><img src="https://avatars.githubusercontent.com/u/5584672?v=4?s=100" width="100px;" alt="Gleb Shevchenko"/><br /><sub><b>Gleb Shevchenko</b></sub></a><br /><a href="#content-shgew" title="Content">🖋</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/mdmundo"><img src="https://avatars.githubusercontent.com/u/60408300?v=4?s=100" width="100px;" alt="Edmundo Paulino"/><br /><sub><b>Edmundo Paulino</b></sub></a><br /><a href="#infra-mdmundo" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/eroullit"><img src="https://avatars.githubusercontent.com/u/301795?v=4?s=100" width="100px;" alt="Emmanuel Roullit"/><br /><sub><b>Emmanuel Roullit</b></sub></a><br /><a href="#infra-eroullit" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://nidhalmessaoudi.herokuapp.com"><img src="https://avatars.githubusercontent.com/u/63377412?v=4?s=100" width="100px;" alt="Nidhal Messaoudi"/><br /><sub><b>Nidhal Messaoudi</b></sub></a><br /><a href="https://github.com/rust-lang/rustlings/commits?author=nidhalmessaoudi" title="Code">💻</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/MahdiBM"><img src="https://avatars.githubusercontent.com/u/54685446?v=4?s=100" width="100px;" alt="Mahdi Bahrami"/><br /><sub><b>Mahdi Bahrami</b></sub></a><br /><a href="#tool-MahdiBM" title="Tools">🔧</a></td>
</tr>
</tbody>
</table>

View File

@@ -1,3 +1,19 @@
<a name="5.4.1"></a>
## 5.4.1 (2023-03-10)
#### Changed
- `vecs`: Added links to `iter_mut` and `map` to README.md
- `cow1`: Changed main to tests
- `iterators1`: Formatted according to rustfmt
#### Fixed
- `errors5`: Unified undisclosed type notation
- `arc1`: Improved readability by avoiding implicit dereference
- `macros4`: Prevented auto-fix by adding `#[rustfmt::skip]`
- `cli`: Actually show correct progress percentages
<a name="5.4.0"></a>
## 5.4.0 (2023-02-12)

View File

@@ -1,6 +1,6 @@
[package]
name = "rustlings"
version = "5.4.0"
version = "5.4.1"
authors = [
"Liv <mokou@fastmail.com>",
"Carol (Nichols || Goulding) <carol.nichols@gmail.com>",

View File

@@ -33,8 +33,8 @@ This will install Rustlings and give you access to the `rustlings` command. Run
Basically: Clone the repository at the latest tag, finally run `nix develop` or `nix-shell`.
```bash
# find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 5.4.0)
git clone -b 5.4.0 --depth 1 https://github.com/rust-lang/rustlings
# find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 5.4.1)
git clone -b 5.4.1 --depth 1 https://github.com/rust-lang/rustlings
cd rustlings
# if nix version > 2.3
nix develop
@@ -62,17 +62,17 @@ If you get a permission denied message, you might have to exclude the directory
## Browser
[Run on Repl.it](https://repl.it/github/rust-lang/rustlings)
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/rust-lang/rustlings)
[![Open Rustlings On Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new/?repo=rust-lang%2Frustlings&ref=main)
## Manually
Basically: Clone the repository at the latest tag, run `cargo install --path .`.
```bash
# find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 5.4.0)
git clone -b 5.4.0 --depth 1 https://github.com/rust-lang/rustlings
# find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 5.4.1)
git clone -b 5.4.1 --depth 1 https://github.com/rust-lang/rustlings
cd rustlings
cargo install --force --path .
```
@@ -155,8 +155,7 @@ for you:
rm -rf rustlings # or your custom folder name, if you chose and or renamed it
```
Second, since Rustlings got installed via `cargo install`, it's only reasonable to assume that you can also remove it using Cargo, and
exactly that is the case. Run `cargo uninstall` to remove the `rustlings` binary:
Second, run `cargo uninstall` to remove the `rustlings` binary:
```bash
cargo uninstall rustlings

View File

@@ -4,7 +4,7 @@
// This exercise uses some concepts that we won't get to until later in the course, like `Box` and the
// `From` trait. It's not important to understand them in detail right now, but you can read ahead if you like.
// For now, think of the `Box<dyn ...>` type as an "I want anything that does ???" type, which, given
// For now, think of the `Box<dyn ???>` type as an "I want anything that does ???" type, which, given
// Rust's usual standards for runtime safety, should strike you as somewhat lenient!
// In short, this particular use case for boxes is for when you want to own a value and you care only that it is a

View File

@@ -10,7 +10,7 @@
// I AM NOT DONE
fn main () {
fn main() {
let my_fav_fruits = vec!["banana", "custard apple", "avocado", "peach", "raspberry"];
let mut my_iterable_fav_fruits = ???; // TODO: Step 1

View File

@@ -3,6 +3,7 @@
// I AM NOT DONE
#[rustfmt::skip]
macro_rules! my_macro {
() => {
println!("Check out my macro!");

View File

@@ -32,7 +32,7 @@ fn main() {
for offset in 0..8 {
let child_numbers = // TODO
joinhandles.push(thread::spawn(move || {
let sum: u32 = child_numbers.iter().filter(|n| *n % 8 == offset).sum();
let sum: u32 = child_numbers.iter().filter(|&&n| n % 8 == offset).sum();
println!("Sum of offset {} is {}", offset, sum);
}));
}

View File

@@ -4,6 +4,9 @@
// Cow is a clone-on-write smart pointer.
// It can enclose and provide immutable access to borrowed data, and clone the data lazily when mutation or ownership is required.
// The type is designed to work with general borrowed data via the Borrow trait.
//
// This exercise is meant to show you what to expect when passing data to Cow.
// Fix the unit tests by checking for Cow::Owned(_) and Cow::Borrowed(_) at the TODO markers.
// I AM NOT DONE
@@ -20,29 +23,52 @@ fn abs_all<'a, 'b>(input: &'a mut Cow<'b, [i32]>) -> &'a mut Cow<'b, [i32]> {
input
}
fn main() {
// No clone occurs because `input` doesn't need to be mutated.
let slice = [0, 1, 2];
let mut input = Cow::from(&slice[..]);
match abs_all(&mut input) {
Cow::Borrowed(_) => println!("I borrowed the slice!"),
_ => panic!("expected borrowed value"),
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn reference_mutation() -> Result<(), &'static str> {
// Clone occurs because `input` needs to be mutated.
let slice = [-1, 0, 1];
let mut input = Cow::from(&slice[..]);
match abs_all(&mut input) {
Cow::Owned(_) => Ok(()),
_ => Err("Expected owned value"),
}
}
// Clone occurs because `input` needs to be mutated.
let slice = [-1, 0, 1];
let mut input = Cow::from(&slice[..]);
match abs_all(&mut input) {
Cow::Owned(_) => println!("I modified the slice and now own it!"),
_ => panic!("expected owned value"),
#[test]
fn reference_no_mutation() -> Result<(), &'static str> {
// No clone occurs because `input` doesn't need to be mutated.
let slice = [0, 1, 2];
let mut input = Cow::from(&slice[..]);
match abs_all(&mut input) {
// TODO
}
}
// No clone occurs because `input` is already owned.
let slice = vec![-1, 0, 1];
let mut input = Cow::from(slice);
match abs_all(&mut input) {
// TODO
Cow::Borrowed(_) => println!("I own this slice!"),
_ => panic!("expected borrowed value"),
#[test]
fn owned_no_mutation() -> Result<(), &'static str> {
// We can also pass `slice` without `&` so Cow owns it directly.
// In this case no mutation occurs and thus also no clone,
// but the result is still owned because it always was.
let slice = vec![0, 1, 2];
let mut input = Cow::from(slice);
match abs_all(&mut input) {
// TODO
}
}
#[test]
fn owned_mutation() -> Result<(), &'static str> {
// Of course this is also the case if a mutation does occur.
// In this case the call to `to_mut()` returns a reference to
// the same data as before.
let slice = vec![-1, 0, 1];
let mut input = Cow::from(slice);
match abs_all(&mut input) {
// TODO
}
}
}

View File

@@ -13,3 +13,5 @@ the other useful data structure, hash maps, later.
## Further information
- [Storing Lists of Values with Vectors](https://doc.rust-lang.org/stable/book/ch08-01-vectors.html)
- [`iter_mut`](https://doc.rust-lang.org/std/primitive.slice.html#method.iter_mut)
- [`map`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.map)

View File

@@ -22,7 +22,7 @@
rustlings =
pkgs.rustPlatform.buildRustPackage {
name = "rustlings";
version = "5.4.0";
version = "5.4.1";
buildInputs = cargoBuildInputs;

View File

@@ -1010,11 +1010,11 @@ https://doc.rust-lang.org/stable/book/ch16-00-concurrency.html
[[exercises]]
name = "cow1"
path = "exercises/smart_pointers/cow1.rs"
mode = "compile"
mode = "test"
hint = """
Since the vector is already owned, the `Cow` type doesn't need to clone it.
If Cow already owns the data it doesn't need to clone it when to_mut() is called.
Checkout https://doc.rust-lang.org/std/borrow/enum.Cow.html for documentation
Check out https://doc.rust-lang.org/std/borrow/enum.Cow.html for documentation
on the `Cow` type.
"""

View File

@@ -141,7 +141,7 @@ git clone -q https://github.com/rust-lang/rustlings "$Path"
cd "$Path"
Version=$(curl -s https://api.github.com/repos/rust-lang/rustlings/releases/latest | ${PY} -c "import json,sys;obj=json.load(sys.stdin);print(obj['tag_name']);")
Version=$(curl -s https://api.github.com/repos/rust-lang/rustlings/releases/latest | ${PY} -c "import json,sys;obj=json.load(sys.stdin);print(obj['tag_name']) if 'tag_name' in obj else sys.exit(f\"Error: {obj['message']}\");")
CargoBin="${CARGO_HOME:-$HOME/.cargo}/bin"
if [[ -z ${Version} ]]

View File

@@ -26,7 +26,7 @@ mod run;
mod verify;
// In sync with crate version
const VERSION: &str = "5.4.0";
const VERSION: &str = "5.4.1";
#[derive(FromArgs, PartialEq, Debug)]
/// Rustlings is a collection of small exercises to get you used to writing and reading Rust code

View File

@@ -13,14 +13,15 @@ pub fn verify<'a>(
progress: (usize, usize),
verbose: bool,
) -> Result<(), &'a Exercise> {
let (mut num_done, total) = progress;
let (num_done, total) = progress;
let bar = ProgressBar::new(total as u64);
let mut percentage = num_done as f32 / total as f32 * 100.0;
bar.set_style(ProgressStyle::default_bar()
.template("Progress: [{bar:60.green/red}] {pos}/{len} {msg}")
.progress_chars("#>-")
);
bar.set_position(num_done as u64);
bar.set_message(format!("({:.1} %)", 0.));
bar.set_message(format!("({:.1} %)", percentage));
for exercise in exercises {
let compile_result = match exercise.mode {
@@ -31,8 +32,7 @@ pub fn verify<'a>(
if !compile_result.unwrap_or(false) {
return Err(exercise);
}
num_done += 1;
let percentage = num_done as f32 / total as f32 * 100.0;
percentage += 100.0 / total as f32;
bar.inc(1);
bar.set_message(format!("({:.1} %)", percentage));
}