Skip to content

Commit f5ce4cf

Browse files
committed
Merge branch 'v6'
2 parents 888ad35 + ff3e6c0 commit f5ce4cf

File tree

263 files changed

+9355
-7796
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

263 files changed

+9355
-7796
lines changed

.all-contributorsrc

Lines changed: 0 additions & 2752 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

.gitattributes

Lines changed: 0 additions & 2 deletions
This file was deleted.

.gitignore

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1-
*.swp
1+
# Cargo
22
target/
3-
**/*.rs.bk
3+
Cargo.lock
4+
!/Cargo.lock
5+
6+
# State file
7+
.rustlings-state.txt
8+
9+
# oranda
10+
public/
11+
.netlify
12+
13+
# OS
414
.DS_Store
5-
*.pdb
6-
exercises/22_clippy/Cargo.toml
7-
exercises/22_clippy/Cargo.lock
8-
rust-project.json
15+
.direnv/
16+
17+
# Editor
18+
*.swp
919
.idea
10-
.vscode/*
11-
!.vscode/extensions.json
1220
*.iml
13-
*.o
14-
public/
15-
.direnv/
1621

17-
# Local Netlify folder
18-
.netlify
22+
# Ignore file for editors like Helix
23+
.ignore

.gitpod.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

.typos.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[files]
2+
extend-exclude = [
3+
"CHANGELOG.md",
4+
]
5+
6+
[default.extend-words]
7+
"ratatui" = "ratatui"

.vscode/extensions.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

AUTHORS.md

Lines changed: 0 additions & 398 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,72 @@
1+
<a name="6.0.0"></a>
2+
3+
## 6.0.0 (2024-07-03)
4+
5+
This release is the result of a complete rewrite to deliver a ton of new features and improvements ✨
6+
The most important changes are highlighted below.
7+
8+
### Installation
9+
10+
The installation has been simplified a lot!
11+
To install Rustlings after installing Rust, all what you need to do now is running the following command:
12+
13+
```bash
14+
cargo install rustlings
15+
```
16+
17+
Yes, this means that Rustlings is now on [crates.io](https://crates.io/crates/rustlings) 🎉
18+
19+
You can read about the motivations of this change in [this issue](https://github.com/rust-lang/rustlings/issues/1919).
20+
21+
### UI/UX
22+
23+
- The UI is now responsive when the terminal is resized.
24+
- The progress bar was moved to the bottom so that you can always see your progress and the current exercise to work on.
25+
- The current exercise path is now a terminal link. It will open the exercise file in your default editor when you click on it.
26+
- A small prompt is now always shown at the bottom. It allows you to choose an action by entering a character. For example, entering `h` will show you the hint of the current exercise.
27+
- The comment "I AM NOT DONE!" doesn't exist anymore. Instead of needing to remove it to go to the next exercise, you need to enter `n` in the terminal.
28+
29+
### List mode
30+
31+
A list mode was added using [Ratatui](https://ratatui.rs).
32+
You can enter it by entering `l` in the watch mode.
33+
It offers the following features:
34+
35+
- Browse all exercises and see their state (pending/done).
36+
- Filter exercises based on their state (pending/done).
37+
- Continue at another exercise. This allows you to skip some exercises or go back to previous ones.
38+
- Reset an exercise so you can start over and revert your changes.
39+
40+
### Solutions
41+
42+
After finishing an exercise, a solution file will be available and Rustlings will show you its path in green.
43+
This allows you to compare your solution with an idiomatic solution and maybe learn about other ways to solve a problem.
44+
45+
While writing the solutions, all exercises have been polished 🌟
46+
For example, every exercise now contains `TODO` comments to highlight what the user needs to change and where.
47+
48+
### LSP support out of the box
49+
50+
Instead of creating a `project.json` file using `rustlings lsp`, Rustlings now works with a `Cargo.toml` file out of the box.
51+
No actions are needed to activate the language server `rust-analyzer`.
52+
53+
This should avoid issues related to the language server or to running exercises, especially the ones with Clippy.
54+
55+
### Clippy
56+
57+
Clippy lints are now shown on all exercises, not only the Clippy exercises 📎
58+
Make Clippy your friend from early on 🥰
59+
60+
### Third party exercises
61+
62+
Rustlings now supports third-party exercises!
63+
64+
Do you want to create your own set of Rustlings exercises to focus on some specific topic?
65+
Or do you want to translate the original Rustlings exercises?
66+
Then follow the link to the guide about [third-party exercises](THIRD_PARTY_EXERCISES.md)!
67+
168
<a name="5.6.1"></a>
69+
270
## 5.6.1 (2023-09-18)
371

472
#### Changed
@@ -15,6 +83,7 @@
1583
- `enums3`: Fixed formatting with `rustfmt`.
1684

1785
<a name="5.6.0"></a>
86+
1887
## 5.6.0 (2023-09-04)
1988

2089
#### Added
@@ -30,7 +99,7 @@
3099
- Swapped the order of threads and smart pointer exercises.
31100
- Rewrote the CLI to use `clap` - it's matured much since we switched to `argh` :)
32101
- `structs3`: Switched from i32 to u32.
33-
- `move_semantics`: Switched 1-4 to tests, and rewrote them to be way simpler, while still teaching about the same
102+
- `move_semantics`: Switched 1-4 to tests, and rewrote them to be way simpler, while still teaching about the same
34103
concepts.
35104

36105
#### Fixed
@@ -55,13 +124,15 @@
55124
- Improved CI workflows, we're now testing on multiple platforms at once.
56125

57126
<a name="5.5.1"></a>
127+
58128
## 5.5.1 (2023-05-17)
59129

60130
#### Fixed
61131

62132
- Reverted `rust-project.json` path generation due to an upstream `rust-analyzer` fix.
63133

64134
<a name="5.5.0"></a>
135+
65136
## 5.5.0 (2023-05-17)
66137

67138
#### Added
@@ -97,6 +168,7 @@
97168
- Split quick installation section into two code blocks
98169

99170
<a name="5.4.1"></a>
171+
100172
## 5.4.1 (2023-03-10)
101173

102174
#### Changed

CONTRIBUTING.md

Lines changed: 37 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,61 @@
1-
## Contributing to Rustlings
1+
# Contributing to Rustlings
22

3-
First off, thanks for taking the time to contribute!! ❤️
3+
First off, thanks for taking the time to contribute! ❤️
44

5-
### Quick Reference
5+
## Quick Reference
66

7-
I want to...
7+
I want to
88

9-
_add an exercise! ➡️ [read this](#addex) and then [open a Pull Request](#prs)_
9+
- _report a bug!_ ➡️ [open an issue](#issues)
10+
- _fix a bug!_ ➡️ [open a pull request](#pull-requests)
11+
- _implement a new feature!_ ➡️ [open an issue to discuss it first, then a pull request](#issues)
12+
- _add an exercise!_ ➡️ [read this](#adding-an-exercise)
13+
- _update an outdated exercise!_ ➡️ [open a pull request](#pull-requests)
1014

11-
_update an outdated exercise! ➡️ [open a Pull Request](#prs)_
12-
13-
_report a bug! ➡️ [open an Issue](#issues)_
14-
15-
_fix a bug! ➡️ [open a Pull Request](#prs)_
16-
17-
_implement a new feature! ➡️ [open an Issue to discuss it first, then a Pull Request](#issues)_
18-
19-
<a name="#src"></a>
20-
### Working on the source code
21-
22-
`rustlings` is basically a glorified `rustc` wrapper. Therefore the source code
23-
isn't really that complicated since the bulk of the work is done by `rustc`.
24-
25-
<a name="addex"></a>
26-
### Adding an exercise
27-
28-
The first step is to add the exercise! Name the file `exercises/yourTopic/yourTopicN.rs`, make sure to
29-
put in some helpful links, and link to sections of the book in `exercises/yourTopic/README.md`.
30-
31-
Next make sure it runs with `rustlings`. The exercise metadata is stored in `info.toml`, under the `exercises` array. The order of the `exercises` array determines the order the exercises are run by `rustlings verify` and `rustlings watch`.
32-
33-
Add the metadata for your exercise in the correct order in the `exercises` array. If you are unsure of the correct ordering, add it at the bottom and ask in your pull request. The exercise metadata should contain the following:
34-
```diff
35-
...
36-
+ [[exercises]]
37-
+ name = "yourTopicN"
38-
+ path = "exercises/yourTopic/yourTopicN.rs"
39-
+ mode = "compile"
40-
+ hint = """
41-
+ Some kind of useful hint for your exercise."""
42-
...
43-
```
44-
45-
The `mode` attribute decides whether Rustlings will only compile your exercise, or compile and test it. If you have tests to verify in your exercise, choose `test`, otherwise `compile`. If you're working on a Clippy exercise, use `mode = "clippy"`.
46-
47-
That's all! Feel free to put up a pull request.
48-
49-
<a name="issues"></a>
50-
### Issues
15+
## Issues
5116

5217
You can open an issue [here](https://github.com/rust-lang/rustlings/issues/new).
5318
If you're reporting a bug, please include the output of the following commands:
5419

55-
- `rustc --version`
20+
- `cargo --version`
5621
- `rustlings --version`
5722
- `ls -la`
5823
- Your OS name and version
5924

60-
<a name="prs"></a>
61-
### Pull Requests
62-
63-
Opening a pull request is as easy as forking the repository and committing your
64-
changes. There's a couple of things to watch out for:
65-
66-
#### Write correct commit messages
67-
68-
We follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
69-
specification.
70-
This means that you have to format your commit messages in a specific way. Say
71-
you're working on adding a new exercise called `foobar1.rs`. You could write
72-
the following commit message:
73-
74-
```
75-
feat: add foobar1.rs exercise
76-
```
25+
## Pull Requests
7726

78-
If you're just fixing a bug, please use the `fix` type:
27+
You are welcome to open a pull request, but unless it is small and trivial, **please open an issue to discuss your idea first** 🙏🏼
7928

80-
```
81-
fix(verify): make sure verify doesn't self-destruct
82-
```
29+
Opening a pull request is as easy as forking the repository and committing your changes.
30+
If you need any help with it or face any Git related problems, don't hesitate to ask for help 🤗
8331

84-
The scope within the brackets is optional, but should be any of these:
32+
It may take time to review your pull request.
33+
Please be patient 😇
8534

86-
- `installation` (for the installation script)
87-
- `cli` (for general CLI changes)
88-
- `verify` (for the verification source file)
89-
- `watch` (for the watch functionality source)
90-
- `run` (for the run functionality source)
91-
- `EXERCISENAME` (if you're changing a specific exercise, or set of exercises,
92-
substitute them here)
35+
When updating an exercise, check if its solution needs to be updated.
9336

94-
When the commit also happens to close an existing issue, link it in the message
95-
body:
37+
## Adding An Exercise
9638

97-
```
98-
fix: update foobar
39+
- Name the file `exercises/yourTopic/yourTopicN.rs`.
40+
- Make sure to put in some helpful links, and link to sections of The Book in `exercises/yourTopic/README.md`.
41+
- In the exercise, add a `// TODO: …` comment where user changes are required.
42+
- Add a solution at `solutions/yourTopic/yourTopicN.rs` with comments explaining it.
43+
- Add the [metadata for your exercise](#exercise-metadata) in the `rustlings-macros/info.toml` file.
44+
- Make sure your exercise runs with `rustlings run yourTopicN`.
45+
- [Open a pull request](#pull-requests).
9946

100-
closes #101029908
101-
```
47+
### Exercise Metadata
10248

103-
If you're doing simple changes, like updating a book link, use `chore`:
49+
The exercise metadata should contain the following:
10450

51+
```toml
52+
[[exercises]]
53+
name = "yourTopicN"
54+
dir = "yourTopic"
55+
hint = """
56+
A useful (multi-line) hint for your exercise.
57+
Include links to a section in The Book or a documentation page."""
10558
```
106-
chore: update exercise1.rs book link
107-
```
108-
109-
If you're updating documentation, use `docs`:
110-
111-
```
112-
docs: add more information to Readme
113-
```
114-
115-
If, and only if, you're absolutely sure you want to make a breaking change
116-
(please discuss this beforehand!), add an exclamation mark to the type and
117-
explain the breaking change in the message body:
118-
119-
```
120-
fix!: completely change verification
121-
122-
BREAKING CHANGE: This has to be done because lorem ipsum dolor
123-
```
124-
125-
#### Pull Request Workflow
12659

127-
Once you open a Pull Request, it may be reviewed or labeled (or both) until
128-
the maintainers accept your change. Please be patient, it may take some time
129-
for this to happen!
60+
If your exercise doesn't contain any test, add `test = false` to the exercise metadata.
61+
But adding tests is recommended.

0 commit comments

Comments
 (0)