Compare commits

...

13 commits

Author SHA1 Message Date
Grigory Zaripov 41e8d6ff2f
Merge 159f0f0afc into c7a18b0781 2024-05-13 13:57:55 +02:00
Mo c7a18b0781
Merge pull request #1974 from hamirmahal/refactor/remove-referent-for-readability
refactor: remove `referent` to improve readability
2024-05-13 00:15:28 +02:00
Hamir Mahal 01a78531ad
refactor: remove referent to improve readability 2024-05-12 15:10:50 -07:00
Mo c2414b8891
Merge pull request #1951 from hamirmahal/ci/add-clippy-job-to-workflow
ci: add `clippy` job to `rust.yml` workflow
2024-05-12 22:47:45 +02:00
Mo f03020a7e2
Merge pull request #1961 from Allupeng/main
docs : add a comma in structs3.rs file
2024-05-12 22:46:07 +02:00
mo8it 01509a2a84 Remove comma 2024-05-12 22:45:18 +02:00
Mo 66b3a9cdd7
Merge pull request #1973 from iamcult/main
chore: update flake.lock
2024-05-12 22:25:54 +02:00
iamcult baca8c9667
chore: update flake.lock 2024-05-12 14:48:06 -04:00
allupeng 8c3b8dcec4 doc : add a dot in hashmaps1.rs file to fill e.g. 2024-04-29 14:18:04 +08:00
allupeng 881d3e9441 doc : add a dot in structs3.rs file 2024-04-28 18:03:22 +08:00
Hamir Mahal 4eec81a113
ci: add clippy job to rust.yml workflow 2024-04-17 01:35:53 -07:00
Hamir Mahal 9a13bccd63
chore: changes from formatting on save 2024-04-17 01:35:29 -07:00
Grigory Zaripov 159f0f0afc
refactor: swap modules and strings order to be consistent with the rust book 2024-03-30 23:47:30 +03:00
13 changed files with 54 additions and 49 deletions

View file

@ -2,14 +2,19 @@ name: Rustlings Tests
on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo clippy -- --deny warnings
fmt:
runs-on: ubuntu-latest
steps:

View file

@ -3,7 +3,7 @@
// A basket of fruits in the form of a hash map needs to be defined. The key
// represents the name of the fruit and the value represents how many of that
// particular fruit is in the basket. You have to put at least three different
// types of fruits (e.g apple, banana, mango) in the basket and the total count
// types of fruits (e.g. apple, banana, mango) in the basket and the total count
// of all the fruits should be at least five.
//
// Make me compile and pass the tests!

View file

@ -3,11 +3,11 @@
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
@ -21,11 +21,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1692799911,
"narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=",
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
@ -36,11 +36,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1694183432,
"narHash": "sha256-YyPGNapgZNNj51ylQMw9lAgvxtM2ai1HZVUu3GS8Fng=",
"lastModified": 1715447595,
"narHash": "sha256-VsVAUQOj/cS1LCOmMjAGeRksXIAdPnFIjCQ0XLkCsT0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "db9208ab987cdeeedf78ad9b4cf3c55f5ebd269b",
"rev": "062ca2a9370a27a35c524dc82d540e6e9824b652",
"type": "github"
},
"original": {

View file

@ -378,7 +378,7 @@ path = "exercises/06_move_semantics/move_semantics5.rs"
mode = "test"
hint = """
Carefully reason about the range in which each mutable reference is in
scope. Does it help to update the value of referent (`x`) immediately after
scope. Does it help to update the value of `x` immediately after
the mutable reference is taken? Read more about 'Mutable References'
in the book's section 'References and Borrowing':
https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#mutable-references.
@ -479,11 +479,43 @@ And then create a match expression in `process()`.
Note that you need to deconstruct some message variants in the match expression
to get value in the variant."""
# MODULES
[[exercises]]
name = "modules1"
path = "exercises/09_modules/modules1.rs"
mode = "compile"
hint = """
Everything is private in Rust by default-- but there's a keyword we can use
to make something public! The compiler error should point to the thing that
needs to be public."""
[[exercises]]
name = "modules2"
path = "exercises/09_modules/modules2.rs"
mode = "compile"
hint = """
The delicious_snacks module is trying to present an external interface that is
different than its internal structure (the `fruits` and `veggies` modules and
associated constants). Complete the `use` statements to fit the uses in main and
find the one keyword missing for both constants.
Learn more at https://doc.rust-lang.org/book/ch07-04-bringing-paths-into-scope-with-the-use-keyword.html#re-exporting-names-with-pub-use"""
[[exercises]]
name = "modules3"
path = "exercises/09_modules/modules3.rs"
mode = "compile"
hint = """
`UNIX_EPOCH` and `SystemTime` are declared in the `std::time` module. Add a
`use` statement for these two to bring them into scope. You can use nested
paths or the glob operator to bring these two in using only one line."""
# STRINGS
[[exercises]]
name = "strings1"
path = "exercises/09_strings/strings1.rs"
path = "exercises/10_strings/strings1.rs"
mode = "compile"
hint = """
The `current_favorite_color` function is currently returning a string slice
@ -497,7 +529,7 @@ another way that uses the `From` trait."""
[[exercises]]
name = "strings2"
path = "exercises/09_strings/strings2.rs"
path = "exercises/10_strings/strings2.rs"
mode = "compile"
hint = """
Yes, it would be really easy to fix this by just changing the value bound to
@ -512,7 +544,7 @@ https://doc.rust-lang.org/stable/book/ch15-02-deref.html#implicit-deref-coercion
[[exercises]]
name = "strings3"
path = "exercises/09_strings/strings3.rs"
path = "exercises/10_strings/strings3.rs"
mode = "test"
hint = """
There's tons of useful standard library functions for strings. Let's try and use some of them:
@ -523,42 +555,10 @@ the string slice into an owned string, which you can then freely extend."""
[[exercises]]
name = "strings4"
path = "exercises/09_strings/strings4.rs"
path = "exercises/10_strings/strings4.rs"
mode = "compile"
hint = "No hints this time ;)"
# MODULES
[[exercises]]
name = "modules1"
path = "exercises/10_modules/modules1.rs"
mode = "compile"
hint = """
Everything is private in Rust by default-- but there's a keyword we can use
to make something public! The compiler error should point to the thing that
needs to be public."""
[[exercises]]
name = "modules2"
path = "exercises/10_modules/modules2.rs"
mode = "compile"
hint = """
The delicious_snacks module is trying to present an external interface that is
different than its internal structure (the `fruits` and `veggies` modules and
associated constants). Complete the `use` statements to fit the uses in main and
find the one keyword missing for both constants.
Learn more at https://doc.rust-lang.org/book/ch07-04-bringing-paths-into-scope-with-the-use-keyword.html#re-exporting-names-with-pub-use"""
[[exercises]]
name = "modules3"
path = "exercises/10_modules/modules3.rs"
mode = "compile"
hint = """
`UNIX_EPOCH` and `SystemTime` are declared in the `std::time` module. Add a
`use` statement for these two to bring them into scope. You can use nested
paths or the glob operator to bring these two in using only one line."""
# HASHMAPS
[[exercises]]