Skip to content

Commit e423602

Browse files
committed
Remove indentation when surrounding code is hidden/removed
Also this code doesn't change between the examples, so I don't think we need to test it every time
1 parent 02c7fca commit e423602

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/ch07-03-recoverable-errors-with-result.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,28 +64,16 @@ correspond to these cases, respectively. So the type `Result<bool, &'static
6464
str>` means that in the successful `Ok` case, we will be returning a `bool`.
6565
But in the failure `Err` case, we will be returning a string literal.
6666

67-
```rust
68-
# fn check_guess(number: u32) -> Result<bool, &'static str> {
69-
# if number > 100 {
70-
return Err("Number was out of range");
71-
# }
72-
#
73-
# Ok(number == 34)
74-
# }
67+
```rust,ignore
68+
return Err("Number was out of range");
7569
```
7670

7771
The second change we need to make is to our error case. Instead of causing a
7872
`panic!`, we now `return` an `Err`, with a string literal inside. Remember,
7973
`Result<T, E>` is an enum: `Err` is one of its variants.
8074

81-
```rust
82-
# fn check_guess(number: u32) -> Result<bool, &'static str> {
83-
# if number > 100 {
84-
# return Err("Number was out of range");
85-
# }
86-
#
87-
Ok(number == 34)
88-
# }
75+
```rust,ignore
76+
Ok(number == 34)
8977
```
9078

9179
We also need to handle the successful case as well, and we make a change

0 commit comments

Comments
 (0)