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: on:
push: push:
branches: [ main ] branches: [main]
pull_request: pull_request:
branches: [ main ] branches: [main]
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
jobs: jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo clippy -- --deny warnings
fmt: fmt:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

View file

@ -3,7 +3,7 @@
// A basket of fruits in the form of a hash map needs to be defined. The key // 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 // 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 // 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. // of all the fruits should be at least five.
// //
// Make me compile and pass the tests! // Make me compile and pass the tests!

View file

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

View file

@ -378,7 +378,7 @@ path = "exercises/06_move_semantics/move_semantics5.rs"
mode = "test" mode = "test"
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
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' 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.
@ -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 Note that you need to deconstruct some message variants in the match expression
to get value in the variant.""" 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 # STRINGS
[[exercises]] [[exercises]]
name = "strings1" name = "strings1"
path = "exercises/09_strings/strings1.rs" path = "exercises/10_strings/strings1.rs"
mode = "compile" mode = "compile"
hint = """ hint = """
The `current_favorite_color` function is currently returning a string slice The `current_favorite_color` function is currently returning a string slice
@ -497,7 +529,7 @@ another way that uses the `From` trait."""
[[exercises]] [[exercises]]
name = "strings2" name = "strings2"
path = "exercises/09_strings/strings2.rs" path = "exercises/10_strings/strings2.rs"
mode = "compile" mode = "compile"
hint = """ hint = """
Yes, it would be really easy to fix this by just changing the value bound to 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]] [[exercises]]
name = "strings3" name = "strings3"
path = "exercises/09_strings/strings3.rs" path = "exercises/10_strings/strings3.rs"
mode = "test" mode = "test"
hint = """ hint = """
There's tons of useful standard library functions for strings. Let's try and use some of them: 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]] [[exercises]]
name = "strings4" name = "strings4"
path = "exercises/09_strings/strings4.rs" path = "exercises/10_strings/strings4.rs"
mode = "compile" mode = "compile"
hint = "No hints this time ;)" 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 # HASHMAPS
[[exercises]] [[exercises]]