Compare commits

..

No commits in common. "5bf8d1fa1bcbf885c7cd9c7ae49494826c209da6" and "0338b1cbdfa567d5f9580afef1d4483c7d275c32" have entirely different histories.

8 changed files with 24 additions and 43 deletions

24
Cargo.lock generated
View file

@ -151,9 +151,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.7" version = "4.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f" checksum = "a9689a29b593160de5bc4aacab7b5d54fb52231de70122626c178e6a368994c7"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@ -161,9 +161,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.5.7" version = "4.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f" checksum = "2e5387378c84f6faa26890ebf9f0a92989f8873d4d380467bcd0d8d8620424df"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -422,9 +422,9 @@ dependencies = [
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.7.4" version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]] [[package]]
name = "mio" name = "mio"
@ -615,9 +615,9 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.10.5" version = "1.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@ -627,9 +627,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-automata" name = "regex-automata"
version = "0.4.7" version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@ -638,9 +638,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.8.4" version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
[[package]] [[package]]
name = "rustlings" name = "rustlings"

View file

@ -47,7 +47,7 @@ include = [
[dependencies] [dependencies]
anyhow = "1.0.86" anyhow = "1.0.86"
clap = { version = "4.5.7", features = ["derive"] } clap = { version = "4.5.6", features = ["derive"] }
crossterm = "0.27.0" crossterm = "0.27.0"
hashbrown = "0.14.5" hashbrown = "0.14.5"
notify-debouncer-mini = { version = "0.4.1", default-features = false } notify-debouncer-mini = { version = "0.4.1", default-features = false }

View file

@ -2,7 +2,7 @@ fn main() {
let number = "T-H-R-E-E"; // Don't change this line let number = "T-H-R-E-E"; // Don't change this line
println!("Spell a number: {}", number); println!("Spell a number: {}", number);
// TODO: Fix the compiler error by changing the line below without renaming the variable. // TODO: Fix the compiler error by changing the line below without renaming the the variable.
number = 3; number = 3;
println!("Number plus two is: {}", number + 2); println!("Number plus two is: {}", number + 2);
} }

View file

@ -1,5 +1,5 @@
fn main() { fn main() {
// TODO: Create an array called `a` with at least 100 elements in it. // TODO: Create an array with at least 100 elements in it where the ??? is.
// let a = ??? // let a = ???
if a.len() >= 100 { if a.len() >= 100 {

View file

@ -1,15 +1,18 @@
// Get a slice out of Array a where the ??? is so that the test passes.
fn main() { fn main() {
// You can optionally experiment here. // You can optionally experiment here.
} }
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
#[test] #[test]
fn slice_out_of_array() { fn slice_out_of_array() {
let a = [1, 2, 3, 4, 5]; let a = [1, 2, 3, 4, 5];
// TODO: Get a slice called `nice_slice` out of the array `a` so that the test passes. let nice_slice = ???
// let nice_slice = ???
assert_eq!([2, 3, 4], nice_slice); assert_eq!([2, 3, 4], nice_slice);
} }

View file

@ -267,8 +267,8 @@ dir = "04_primitive_types"
hint = """ hint = """
Take a look at the 'Understanding Ownership -> Slices -> Other Slices' section Take a look at the 'Understanding Ownership -> Slices -> Other Slices' section
of the book: https://doc.rust-lang.org/book/ch04-03-slices.html and use the of the book: https://doc.rust-lang.org/book/ch04-03-slices.html and use the
starting and ending (plus one) indices of the items in the array that you want starting and ending (plus one) indices of the items in the `Array` that you
to end up in the slice. want to end up in the slice.
If you're curious why the first argument of `assert_eq!` does not have an If you're curious why the first argument of `assert_eq!` does not have an
ampersand for a reference since the second argument is a reference, take a look ampersand for a reference since the second argument is a reference, take a look

View file

@ -1,23 +1 @@
fn main() { // Solutions will be available before the stable release. Thank you for testing the beta version 🥰
// You can optionally experiment here.
}
#[cfg(test)]
mod tests {
#[test]
fn slice_out_of_array() {
let a = [1, 2, 3, 4, 5];
// 0 1 2 3 4 <- indices
// -------
// |
// +--- slice
// Note that the upper index 4 is excluded.
let nice_slice = &a[1..4];
assert_eq!([2, 3, 4], nice_slice);
// The upper index can be included by using the syntax `..=` (with `=` sign)
let nice_slice = &a[1..=3];
assert_eq!([2, 3, 4], nice_slice);
}
}

View file

@ -151,7 +151,7 @@ fn main() -> Result<()> {
let notify_exercise_names = if args.manual_run { let notify_exercise_names = if args.manual_run {
None None
} else { } else {
// For the notify event handler thread. // For the the notify event handler thread.
// Leaking is not a problem because the slice lives until the end of the program. // Leaking is not a problem because the slice lives until the end of the program.
Some( Some(
&*app_state &*app_state