| Age | Commit message (Collapse) | Author |
|
closes #859
closes #913
closes #942
|
|
feat(intro): Proposal to add successfully compiling exercise as the first exercise.
|
|
docs(option): improve further information if let and while let
|
|
as a totally newbie to Rust, I don't know panic statement from https://doc.rust-lang.org/book/ and rustlings in the beginning. After a hard searching of [should_panic], then I figure out panic statement.
So it's helpful to tell the learner that write a panic statement here.
|
|
Signed-off-by: zydxhs <johnsmithcry@163.com>
|
|
|
|
approx_constant lint rule
closes #888
|
|
Intended to simplify the lesson by removing the need to figure out what the value is meant to be based on the tests.
Previous commits (https://github.com/rust-lang/rustlings/commit/9ca08b8f2b09366e97896a4a8cf9ff3bb4d54380 and https://github.com/rust-lang/rustlings/commit/114b54cbdb977234b39e5f180d937c14c78bb8b2#diff-ce1c232ff0ddaff909351bb84cb5bff423b5b9e04f21fd4db7ffe443e598e174) removed the mathematical complexity, and I feel this addition is a needed change to further streamline the exercise.
|
|
Co-authored-by: zhangshaozhi <zhangshaozhi@ZhangshaozhideMacBook-Pro.local>
|
|
|
|
|
|
feature: advanced errors
|
|
New exercise to demonstrate traits that make it easier for other code
to consume our custom error types.
|
|
New section and exercise to demonstrate the `From` trait for errors
and its usefulness with the `?` operator.
|
|
Instead of having to explain why
```rs
let mut x = 100;
let y = &mut x;
let mut z_owned = *y;
let z = &mut z_owned;
*y += 100;
*z += 1000;
```
and
```rs
let mut x = 100;
let y = &mut x;
let z = &mut *y;
*y += 100;
*z += 1000;
```
are different, you still get the point across about having only one mutable reference.
As it stands, this exercise does too much (dereferencing and having only one mutable reference), and by doing so confuses people.
Example of someone being confused by this:
<https://discord.com/channels/273534239310479360/273541522815713281/872689531428692040>
|
|
|
|
|
|
Co-authored-by: diannasoriel <mokou@fastmail.com>
|
|
|
|
The second test expects the function to return 80 when there is an order of 40 apples, but the current wording implies returning 40 will pass as well
|
|
|
|
chore(iterators5): Minor formatting improvements.
|
|
Correct small typo in exercises/conversions/from_str.rs
|
|
Co-authored-by: Rakshit Sinha <rakshit.sinha@oracle.com>
|
|
|
|
|
|
Remove the use of trait objects as errors from `from_str` and
`try_from_into`; they seem to have caused a lot of confusion in
practice. (Also, it's considered best practice to use custom error
types instead of boxed errors in library code.) Instead, use custom
error enums, and update hints accordingly. Hints also provide
some guidance about converting errors, which could be covered
more completely in a future advanced errors section.
Also move from_str to directly after the similar exercise `from_into`,
for the sake of familiarity when solving.
|
|
fix(iterators5): derive Clone, Copy
|
|
feature: improve error_handling exercises
|
|
Adjust error text and naming to conform with best practices.
Use `map_err()` instead of `or()`. Wrap lower-level errors instead of
ignoring their details.
Also, don't "cheat" by bypassing the `new()` function in tests.
Fix a dangling reference in the try_from_into hints.
|
|
let mut number = 3; can lead to a correct answer, so the comment helps to direct the users to the intended answer.
|
|
Add new exercises errors5 and errors6, to introduce boxed errors and
custom error enums more gently. Delete errorsn, because it tried to do
too much too soon.
|
|
Also put it in the ERROR HANDLING section where it probably belongs.
|
|
To allow more flexibility in solutions, derive `Clone` and `Copy`
for `Progress`.
|
|
Improve the hints for move_semantics5, as well as the explanatory
comments in the code.
Previously, it was not clear what possible changes were allowed.
It seems that reordering the statements might be the intended solution.
The previous comment about not "adding newlines" doesn't make sense,
so treating it as "adding new lines" makes it more clear.
|
|
* feat: Add move_semantics5 exercise.
* feat: Add option3 exercise
* Address review comments. Fix typos, sentence formatting.
* Remove unwanted newline.
* Address review comments: make comment inline, fix format in print.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
all exercises readme files now have a unified structure and a description
|
|
docs(generics): add bounds help
|
|
add help for bounds provided by the rust by example book
|
|
add additional help information provided by the rust by example book
|