summaryrefslogtreecommitdiffstats
path: root/src/doc/rust-by-example
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/rust-by-example')
-rw-r--r--src/doc/rust-by-example/README.md1
-rw-r--r--src/doc/rust-by-example/src/error/panic.md3
-rw-r--r--src/doc/rust-by-example/src/flow_control/loop/nested.md4
-rw-r--r--src/doc/rust-by-example/src/hello/print/fmt.md6
4 files changed, 11 insertions, 3 deletions
diff --git a/src/doc/rust-by-example/README.md b/src/doc/rust-by-example/README.md
index e43b044c8..2529a3fad 100644
--- a/src/doc/rust-by-example/README.md
+++ b/src/doc/rust-by-example/README.md
@@ -40,6 +40,7 @@ Please see the [CONTRIBUTING.md] file for more details.
* [French](https://github.com/Songbird0/FR_RBE)
* [Russian](https://github.com/ruRust/rust-by-example)
* [Vietnamese](https://github.com/EyesCrypto-Insights/rust-by-example-vn)
+* [Portuguese](https://github.com/nazarepiedady/rust-com-exemplos)
## License
diff --git a/src/doc/rust-by-example/src/error/panic.md b/src/doc/rust-by-example/src/error/panic.md
index 5524dbf6f..8e3f10109 100644
--- a/src/doc/rust-by-example/src/error/panic.md
+++ b/src/doc/rust-by-example/src/error/panic.md
@@ -15,5 +15,8 @@ fn drink(beverage: &str) {
fn main() {
drink("water");
drink("lemonade");
+ drink("still water");
}
```
+
+The first call to `drink` works. The second panics and thus the third is never called.
diff --git a/src/doc/rust-by-example/src/flow_control/loop/nested.md b/src/doc/rust-by-example/src/flow_control/loop/nested.md
index 01c55a559..01e8f3971 100644
--- a/src/doc/rust-by-example/src/flow_control/loop/nested.md
+++ b/src/doc/rust-by-example/src/flow_control/loop/nested.md
@@ -5,7 +5,7 @@ loops. In these cases, the loops must be annotated with some `'label`, and the
label must be passed to the `break`/`continue` statement.
```rust,editable
-#![allow(unreachable_code)]
+#![allow(unreachable_code, unused_labels)]
fn main() {
'outer: loop {
@@ -26,4 +26,4 @@ fn main() {
println!("Exited the outer loop");
}
-``` \ No newline at end of file
+```
diff --git a/src/doc/rust-by-example/src/hello/print/fmt.md b/src/doc/rust-by-example/src/hello/print/fmt.md
index c3c78f6b1..b6f676061 100644
--- a/src/doc/rust-by-example/src/hello/print/fmt.md
+++ b/src/doc/rust-by-example/src/hello/print/fmt.md
@@ -78,8 +78,11 @@ RGB (0, 3, 254) 0x0003FE
RGB (0, 0, 0) 0x000000
```
-Two hints if you get stuck:
+Three hints if you get stuck:
+* The formula for calculating a color in the RGB color space is:
+`RGB = (R*65536)+(G*256)+B , (when R is RED, G is GREEN and B is BLUE)`.
+For more see [RGB color format & calculation][rgb_color].
* You [may need to list each color more than once][named_parameters].
* You can [pad with zeros to a width of 2][fmt_width] with `:0>2`.
@@ -87,6 +90,7 @@ Two hints if you get stuck:
[`std::fmt`][fmt]
+[rgb_color]: https://www.rapidtables.com/web/color/RGB_Color.html#rgb-format
[named_parameters]: https://doc.rust-lang.org/std/fmt/#named-parameters
[deadbeef]: https://en.wikipedia.org/wiki/Deadbeef#Magic_debug_values
[fmt]: https://doc.rust-lang.org/std/fmt/