Skip to content

Commit

Permalink
don't put whole function in slide - it doesn't fit
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelraz committed Feb 5, 2025
1 parent 6c5c906 commit 589f5d5
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions training-slides/src/dealing-with-unwrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,7 @@ Let's see how we can get to `?` as quickly as possible in cases where

`?` turns this

```rust []
use std::fs::File;
use std::io::prelude::*;
use std::io;

struct Info {
name: String,
age: i32,
rating: i32,
}

```rust [], ignore
fn write_info(info: &Info) -> io::Result<()> {
// Early return on error
let mut file = match File::create("my_best_friends.txt") {
Expand All @@ -60,17 +50,7 @@ fn write_info(info: &Info) -> io::Result<()> {

Into this

```rust []
use std::fs::File;
use std::io::prelude::*;
use std::io;

struct Info {
name: String,
age: i32,
rating: i32,
}

```rust [], ignore
fn write_info(info: &Info) -> io::Result<()> {
let mut file = File::create("my_best_friends.txt")?;
// Early return on error
Expand Down

0 comments on commit 589f5d5

Please sign in to comment.