mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-01-09 20:03:24 +03:00
Merge branch 'main' into Rustlings
This commit is contained in:
commit
9848681738
|
@ -1155,6 +1155,78 @@
|
||||||
"contributions": [
|
"contributions": [
|
||||||
"content"
|
"content"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "rytheo",
|
||||||
|
"name": "Ryan Lowe",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/22184325?v=4",
|
||||||
|
"profile": "https://github.com/rytheo",
|
||||||
|
"contributions": [
|
||||||
|
"code"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "cuishuang",
|
||||||
|
"name": "cui fliter",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/15921519?v=4",
|
||||||
|
"profile": "http://www.dashen.tech",
|
||||||
|
"contributions": [
|
||||||
|
"content"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "luskwater",
|
||||||
|
"name": "Ron Lusk",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/42529?v=4",
|
||||||
|
"profile": "https://github.com/luskwater",
|
||||||
|
"contributions": [
|
||||||
|
"content"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "liby",
|
||||||
|
"name": "Bryan Lee",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/38807139?v=4",
|
||||||
|
"profile": "http://liby.github.io/liby/",
|
||||||
|
"contributions": [
|
||||||
|
"content"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "nandajavarma",
|
||||||
|
"name": "Nandaja Varma",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/2624550?v=4",
|
||||||
|
"profile": "http://nandaja.space",
|
||||||
|
"contributions": [
|
||||||
|
"doc"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "merelymyself",
|
||||||
|
"name": "pwygab",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/88221256?v=4",
|
||||||
|
"profile": "https://github.com/merelymyself",
|
||||||
|
"contributions": [
|
||||||
|
"code"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "lucasgrvarela",
|
||||||
|
"name": "Lucas Grigolon Varela",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/37870368?v=4",
|
||||||
|
"profile": "http://linkedin.com/in/lucasgrvarela",
|
||||||
|
"contributions": [
|
||||||
|
"content"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "bufo24",
|
||||||
|
"name": "Bufo",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/32884105?v=4",
|
||||||
|
"profile": "https://github.com/bufo24",
|
||||||
|
"contributions": [
|
||||||
|
"content"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"contributorsPerLine": 8,
|
"contributorsPerLine": 8,
|
||||||
|
|
|
@ -4,4 +4,4 @@ tasks:
|
||||||
|
|
||||||
vscode:
|
vscode:
|
||||||
extensions:
|
extensions:
|
||||||
- rust-lang.rust@0.7.8:CvNqMTgDdt3UXt+6BCDTVg==
|
- rust-lang.rust@0.7.8
|
||||||
|
|
10
AUTHORS.md
10
AUTHORS.md
|
@ -165,6 +165,16 @@ authors.
|
||||||
<td align="center"><a href="https://github.com/stevenfukase"><img src="https://avatars.githubusercontent.com/u/66785624?v=4?s=100" width="100px;" alt=""/><br /><sub><b>stevenfukase</b></sub></a><br /><a href="#content-stevenfukase" title="Content">🖋</a></td>
|
<td align="center"><a href="https://github.com/stevenfukase"><img src="https://avatars.githubusercontent.com/u/66785624?v=4?s=100" width="100px;" alt=""/><br /><sub><b>stevenfukase</b></sub></a><br /><a href="#content-stevenfukase" title="Content">🖋</a></td>
|
||||||
<td align="center"><a href="https://github.com/J-S-Kim"><img src="https://avatars.githubusercontent.com/u/17569303?v=4?s=100" width="100px;" alt=""/><br /><sub><b>J-S-Kim</b></sub></a><br /><a href="#content-J-S-Kim" title="Content">🖋</a></td>
|
<td align="center"><a href="https://github.com/J-S-Kim"><img src="https://avatars.githubusercontent.com/u/17569303?v=4?s=100" width="100px;" alt=""/><br /><sub><b>J-S-Kim</b></sub></a><br /><a href="#content-J-S-Kim" title="Content">🖋</a></td>
|
||||||
<td align="center"><a href="https://github.com/Fointard"><img src="https://avatars.githubusercontent.com/u/9333398?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Fointard</b></sub></a><br /><a href="#content-Fointard" title="Content">🖋</a></td>
|
<td align="center"><a href="https://github.com/Fointard"><img src="https://avatars.githubusercontent.com/u/9333398?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Fointard</b></sub></a><br /><a href="#content-Fointard" title="Content">🖋</a></td>
|
||||||
|
<td align="center"><a href="https://github.com/rytheo"><img src="https://avatars.githubusercontent.com/u/22184325?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ryan Lowe</b></sub></a><br /><a href="https://github.com/rust-lang/rustlings/commits?author=rytheo" title="Code">💻</a></td>
|
||||||
|
<td align="center"><a href="http://www.dashen.tech"><img src="https://avatars.githubusercontent.com/u/15921519?v=4?s=100" width="100px;" alt=""/><br /><sub><b>cui fliter</b></sub></a><br /><a href="#content-cuishuang" title="Content">🖋</a></td>
|
||||||
|
<td align="center"><a href="https://github.com/luskwater"><img src="https://avatars.githubusercontent.com/u/42529?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ron Lusk</b></sub></a><br /><a href="#content-luskwater" title="Content">🖋</a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="center"><a href="http://liby.github.io/liby/"><img src="https://avatars.githubusercontent.com/u/38807139?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Bryan Lee</b></sub></a><br /><a href="#content-liby" title="Content">🖋</a></td>
|
||||||
|
<td align="center"><a href="http://nandaja.space"><img src="https://avatars.githubusercontent.com/u/2624550?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nandaja Varma</b></sub></a><br /><a href="https://github.com/rust-lang/rustlings/commits?author=nandajavarma" title="Documentation">📖</a></td>
|
||||||
|
<td align="center"><a href="https://github.com/merelymyself"><img src="https://avatars.githubusercontent.com/u/88221256?v=4?s=100" width="100px;" alt=""/><br /><sub><b>pwygab</b></sub></a><br /><a href="https://github.com/rust-lang/rustlings/commits?author=merelymyself" title="Code">💻</a></td>
|
||||||
|
<td align="center"><a href="http://linkedin.com/in/lucasgrvarela"><img src="https://avatars.githubusercontent.com/u/37870368?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Lucas Grigolon Varela</b></sub></a><br /><a href="#content-lucasgrvarela" title="Content">🖋</a></td>
|
||||||
|
<td align="center"><a href="https://github.com/bufo24"><img src="https://avatars.githubusercontent.com/u/32884105?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Bufo</b></sub></a><br /><a href="#content-bufo24" title="Content">🖋</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -285,7 +285,7 @@
|
||||||
#### Features
|
#### Features
|
||||||
|
|
||||||
* add Option2 exercise (#290) ([86b5c08b](https://github.com/rust-lang/rustlings/commit/86b5c08b9bea1576127a7c5f599f5752072c087d))
|
* add Option2 exercise (#290) ([86b5c08b](https://github.com/rust-lang/rustlings/commit/86b5c08b9bea1576127a7c5f599f5752072c087d))
|
||||||
* add excercise for option (#282) ([135e5d47](https://github.com/rust-lang/rustlings/commit/135e5d47a7c395aece6f6022117fb20c82f2d3d4))
|
* add exercise for option (#282) ([135e5d47](https://github.com/rust-lang/rustlings/commit/135e5d47a7c395aece6f6022117fb20c82f2d3d4))
|
||||||
* add new exercises for generics (#280) ([76be5e4e](https://github.com/rust-lang/rustlings/commit/76be5e4e991160f5fd9093f03ee2ba260e8f7229))
|
* add new exercises for generics (#280) ([76be5e4e](https://github.com/rust-lang/rustlings/commit/76be5e4e991160f5fd9093f03ee2ba260e8f7229))
|
||||||
* **ci:** add buildkite config ([b049fa2c](https://github.com/rust-lang/rustlings/commit/b049fa2c84dba0f0c8906ac44e28fd45fba51a71))
|
* **ci:** add buildkite config ([b049fa2c](https://github.com/rust-lang/rustlings/commit/b049fa2c84dba0f0c8906ac44e28fd45fba51a71))
|
||||||
|
|
||||||
|
|
12
README.md
12
README.md
|
@ -21,9 +21,9 @@ You will need to have Rust installed. You can get it by visiting https://rustup.
|
||||||
Just run:
|
Just run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -L https://git.io/install-rustlings | bash
|
curl -L https://raw.githubusercontent.com/rust-lang/rustlings/main/install.sh | bash
|
||||||
# Or if you want it to be installed to a different path:
|
# Or if you want it to be installed to a different path:
|
||||||
curl -L https://git.io/install-rustlings | bash -s mypath/
|
curl -L https://raw.githubusercontent.com/rust-lang/rustlings/main/install.sh | bash -s mypath/
|
||||||
```
|
```
|
||||||
|
|
||||||
This will install Rustlings and give you access to the `rustlings` command. Run it to get started!
|
This will install Rustlings and give you access to the `rustlings` command. Run it to get started!
|
||||||
|
@ -39,7 +39,7 @@ Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||||
Then, you can run:
|
Then, you can run:
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
Start-BitsTransfer -Source https://git.io/JTL5v -Destination $env:TMP/install_rustlings.ps1; Unblock-File $env:TMP/install_rustlings.ps1; Invoke-Expression $env:TMP/install_rustlings.ps1
|
Start-BitsTransfer -Source https://raw.githubusercontent.com/rust-lang/rustlings/main/install.ps1 -Destination $env:TMP/install_rustlings.ps1; Unblock-File $env:TMP/install_rustlings.ps1; Invoke-Expression $env:TMP/install_rustlings.ps1
|
||||||
```
|
```
|
||||||
|
|
||||||
To install Rustlings. Same as on MacOS/Linux, you will have access to the `rustlings` command after it.
|
To install Rustlings. Same as on MacOS/Linux, you will have access to the `rustlings` command after it.
|
||||||
|
@ -50,15 +50,15 @@ When you get a permission denied message then you have to exclude the directory
|
||||||
|
|
||||||
[Run on Repl.it](https://repl.it/github/rust-lang/rustlings)
|
[Run on Repl.it](https://repl.it/github/rust-lang/rustlings)
|
||||||
|
|
||||||
[Open in Gitpod](https://gitpod.io/#https://github.com/rust-lang/rustlings)
|
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/rust-lang/rustlings)
|
||||||
|
|
||||||
## Manually
|
## Manually
|
||||||
|
|
||||||
Basically: Clone the repository at the latest tag, run `cargo install`.
|
Basically: Clone the repository at the latest tag, run `cargo install`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 4.6.0)
|
# find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 4.7.1)
|
||||||
git clone -b 4.6.0 --depth 1 https://github.com/rust-lang/rustlings
|
git clone -b 4.7.1 --depth 1 https://github.com/rust-lang/rustlings
|
||||||
cd rustlings
|
cd rustlings
|
||||||
cargo install --force --path .
|
cargo install --force --path .
|
||||||
```
|
```
|
||||||
|
|
|
@ -21,7 +21,7 @@ name = "variables1"
|
||||||
path = "exercises/variables/variables1.rs"
|
path = "exercises/variables/variables1.rs"
|
||||||
mode = "compile"
|
mode = "compile"
|
||||||
hint = """
|
hint = """
|
||||||
Hint: The declaration on line 12 is missing a keyword that is needed in Rust
|
Hint: The declaration on line 8 is missing a keyword that is needed in Rust
|
||||||
to create a new variable binding."""
|
to create a new variable binding."""
|
||||||
|
|
||||||
[[exercises]]
|
[[exercises]]
|
||||||
|
@ -158,7 +158,7 @@ path = "exercises/if/if2.rs"
|
||||||
mode = "test"
|
mode = "test"
|
||||||
hint = """
|
hint = """
|
||||||
For that first compiler error, it's important in Rust that each conditional
|
For that first compiler error, it's important in Rust that each conditional
|
||||||
block return the same type! To get the tests passing, you will need a couple
|
block returns the same type! To get the tests passing, you will need a couple
|
||||||
conditions checking different input values."""
|
conditions checking different input values."""
|
||||||
|
|
||||||
# TEST 1
|
# TEST 1
|
||||||
|
@ -231,7 +231,7 @@ path = "exercises/move_semantics/move_semantics5.rs"
|
||||||
mode = "compile"
|
mode = "compile"
|
||||||
hint = """
|
hint = """
|
||||||
Carefully reason about the range in which each mutable reference is in
|
Carefully reason about the range in which each mutable reference is in
|
||||||
vogue. Does it help to update the value of referent (x) immediately after
|
scope. Does it help to update the value of referent (x) immediately after
|
||||||
the mutable reference is taken? Read more about 'Mutable References'
|
the mutable reference is taken? Read more about 'Mutable References'
|
||||||
in the book's section References and Borrowing':
|
in the book's section References and Borrowing':
|
||||||
https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#mutable-references.
|
https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#mutable-references.
|
||||||
|
|
28
install.sh
28
install.sh
|
@ -25,12 +25,21 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -x "$(command -v rustup)" ]
|
||||||
|
then
|
||||||
|
echo "SUCCESS: rustup is installed"
|
||||||
|
else
|
||||||
|
echo "ERROR: rustup does not seem to be installed."
|
||||||
|
echo "Please download rustup using https://rustup.rs!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -x "$(command -v rustc)" ]
|
if [ -x "$(command -v rustc)" ]
|
||||||
then
|
then
|
||||||
echo "SUCCESS: Rust is installed"
|
echo "SUCCESS: Rust is installed"
|
||||||
else
|
else
|
||||||
echo "ERROR: Rust does not seem to be installed."
|
echo "ERROR: Rust does not seem to be installed."
|
||||||
echo "Please download Rust using https://rustup.rs!"
|
echo "Please download Rust using rustup!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -39,7 +48,7 @@ then
|
||||||
echo "SUCCESS: Cargo is installed"
|
echo "SUCCESS: Cargo is installed"
|
||||||
else
|
else
|
||||||
echo "ERROR: Cargo does not seem to be installed."
|
echo "ERROR: Cargo does not seem to be installed."
|
||||||
echo "Please download Rust and Cargo using https://rustup.rs!"
|
echo "Please download Rust and Cargo using rustup!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -75,6 +84,21 @@ function vercomp() {
|
||||||
then
|
then
|
||||||
max_len=$len2
|
max_len=$len2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#pad right in short arr
|
||||||
|
if [[ len1 -gt len2 ]];
|
||||||
|
then
|
||||||
|
for ((i = len2; i < len1; i++));
|
||||||
|
do
|
||||||
|
v2[$i]=0
|
||||||
|
done
|
||||||
|
else
|
||||||
|
for ((i = len1; i < len2; i++));
|
||||||
|
do
|
||||||
|
v1[$i]=0
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
for i in `seq 0 $max_len`
|
for i in `seq 0 $max_len`
|
||||||
do
|
do
|
||||||
# Fill empty fields with zeros in v1
|
# Fill empty fields with zeros in v1
|
||||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -203,7 +203,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Subcommands::Verify(_subargs) => {
|
Subcommands::Verify(_subargs) => {
|
||||||
verify(&exercises, verbose).unwrap_or_else(|_| std::process::exit(1));
|
verify(&exercises, (0, exercises.len()), verbose).unwrap_or_else(|_| std::process::exit(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
Subcommands::Watch(_subargs) => match watch(&exercises, verbose) {
|
Subcommands::Watch(_subargs) => match watch(&exercises, verbose) {
|
||||||
|
@ -295,7 +295,7 @@ fn watch(exercises: &[Exercise], verbose: bool) -> notify::Result<WatchStatus> {
|
||||||
clear_screen();
|
clear_screen();
|
||||||
|
|
||||||
let to_owned_hint = |t: &Exercise| t.hint.to_owned();
|
let to_owned_hint = |t: &Exercise| t.hint.to_owned();
|
||||||
let failed_exercise_hint = match verify(exercises.iter(), verbose) {
|
let failed_exercise_hint = match verify(exercises.iter(), (0, exercises.len()), verbose) {
|
||||||
Ok(_) => return Ok(WatchStatus::Finished),
|
Ok(_) => return Ok(WatchStatus::Finished),
|
||||||
Err(exercise) => Arc::new(Mutex::new(Some(to_owned_hint(exercise)))),
|
Err(exercise) => Arc::new(Mutex::new(Some(to_owned_hint(exercise)))),
|
||||||
};
|
};
|
||||||
|
@ -308,11 +308,11 @@ fn watch(exercises: &[Exercise], verbose: bool) -> notify::Result<WatchStatus> {
|
||||||
let filepath = b.as_path().canonicalize().unwrap();
|
let filepath = b.as_path().canonicalize().unwrap();
|
||||||
let pending_exercises = exercises
|
let pending_exercises = exercises
|
||||||
.iter()
|
.iter()
|
||||||
.skip_while(|e| !filepath.ends_with(&e.path))
|
.find(|e| filepath.ends_with(&e.path)).into_iter()
|
||||||
// .filter(|e| filepath.ends_with(&e.path))
|
|
||||||
.chain(exercises.iter().filter(|e| !e.looks_done() && !filepath.ends_with(&e.path)));
|
.chain(exercises.iter().filter(|e| !e.looks_done() && !filepath.ends_with(&e.path)));
|
||||||
|
let num_done = exercises.iter().filter(|e| e.looks_done()).count();
|
||||||
clear_screen();
|
clear_screen();
|
||||||
match verify(pending_exercises, verbose) {
|
match verify(pending_exercises, (num_done, exercises.len()), verbose) {
|
||||||
Ok(_) => return Ok(WatchStatus::Finished),
|
Ok(_) => return Ok(WatchStatus::Finished),
|
||||||
Err(exercise) => {
|
Err(exercise) => {
|
||||||
let mut failed_exercise_hint = failed_exercise_hint.lock().unwrap();
|
let mut failed_exercise_hint = failed_exercise_hint.lock().unwrap();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::exercise::{CompiledExercise, Exercise, Mode, State};
|
use crate::exercise::{CompiledExercise, Exercise, Mode, State};
|
||||||
use console::style;
|
use console::style;
|
||||||
use indicatif::ProgressBar;
|
use indicatif::{ProgressBar, ProgressStyle};
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
// Verify that the provided container of Exercise objects
|
// Verify that the provided container of Exercise objects
|
||||||
|
@ -9,10 +9,18 @@ use std::env;
|
||||||
// If the Exercise being verified is a test, the verbose boolean
|
// If the Exercise being verified is a test, the verbose boolean
|
||||||
// determines whether or not the test harness outputs are displayed.
|
// determines whether or not the test harness outputs are displayed.
|
||||||
pub fn verify<'a>(
|
pub fn verify<'a>(
|
||||||
start_at: impl IntoIterator<Item = &'a Exercise>,
|
exercises: impl IntoIterator<Item = &'a Exercise>,
|
||||||
|
progress: (usize, usize),
|
||||||
verbose: bool,
|
verbose: bool,
|
||||||
) -> Result<(), &'a Exercise> {
|
) -> Result<(), &'a Exercise> {
|
||||||
for exercise in start_at {
|
let (num_done, total) = progress;
|
||||||
|
let bar = ProgressBar::new(total as u64);
|
||||||
|
bar.set_style(ProgressStyle::default_bar()
|
||||||
|
.template("Progress: [{bar:60.green/red}] {pos}/{len}")
|
||||||
|
.progress_chars("#>-")
|
||||||
|
);
|
||||||
|
bar.set_position(num_done as u64);
|
||||||
|
for exercise in exercises {
|
||||||
let compile_result = match exercise.mode {
|
let compile_result = match exercise.mode {
|
||||||
Mode::Test => compile_and_test(exercise, RunMode::Interactive, verbose),
|
Mode::Test => compile_and_test(exercise, RunMode::Interactive, verbose),
|
||||||
Mode::Compile => compile_and_run_interactively(exercise),
|
Mode::Compile => compile_and_run_interactively(exercise),
|
||||||
|
@ -21,6 +29,7 @@ pub fn verify<'a>(
|
||||||
if !compile_result.unwrap_or(false) {
|
if !compile_result.unwrap_or(false) {
|
||||||
return Err(exercise);
|
return Err(exercise);
|
||||||
}
|
}
|
||||||
|
bar.inc(1);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -45,7 +54,6 @@ fn compile_only(exercise: &Exercise) -> Result<bool, ()> {
|
||||||
let _ = compile(exercise, &progress_bar)?;
|
let _ = compile(exercise, &progress_bar)?;
|
||||||
progress_bar.finish_and_clear();
|
progress_bar.finish_and_clear();
|
||||||
|
|
||||||
success!("Successfully compiled {}!", exercise);
|
|
||||||
Ok(prompt_for_completion(exercise, None))
|
Ok(prompt_for_completion(exercise, None))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,8 +79,6 @@ fn compile_and_run_interactively(exercise: &Exercise) -> Result<bool, ()> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
success!("Successfully ran {}!", exercise);
|
|
||||||
|
|
||||||
Ok(prompt_for_completion(exercise, Some(output.stdout)))
|
Ok(prompt_for_completion(exercise, Some(output.stdout)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +98,6 @@ fn compile_and_test(exercise: &Exercise, run_mode: RunMode, verbose: bool) -> Re
|
||||||
if verbose {
|
if verbose {
|
||||||
println!("{}", output.stdout);
|
println!("{}", output.stdout);
|
||||||
}
|
}
|
||||||
success!("Successfully tested {}", &exercise);
|
|
||||||
if let RunMode::Interactive = run_mode {
|
if let RunMode::Interactive = run_mode {
|
||||||
Ok(prompt_for_completion(exercise, None))
|
Ok(prompt_for_completion(exercise, None))
|
||||||
} else {
|
} else {
|
||||||
|
@ -138,6 +143,12 @@ fn prompt_for_completion(exercise: &Exercise, prompt_output: Option<String>) ->
|
||||||
State::Pending(context) => context,
|
State::Pending(context) => context,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
match exercise.mode {
|
||||||
|
Mode::Compile => success!("Successfully ran {}!", exercise),
|
||||||
|
Mode::Test => success!("Successfully tested {}!", exercise),
|
||||||
|
Mode::Clippy => success!("Successfully compiled {}!", exercise),
|
||||||
|
}
|
||||||
|
|
||||||
let no_emoji = env::var("NO_EMOJI").is_ok();
|
let no_emoji = env::var("NO_EMOJI").is_ok();
|
||||||
|
|
||||||
let clippy_success_msg = if no_emoji {
|
let clippy_success_msg = if no_emoji {
|
||||||
|
|
Loading…
Reference in a new issue