Skip to content

Commit

Permalink
feat: ? operator chainging
Browse files Browse the repository at this point in the history
Signed-off-by: Fredrik Klingenberg <[email protected]>
  • Loading branch information
fredrkl committed Apr 1, 2024
1 parent 93f4f14 commit a2483d2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions projects/panic/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ fn read_username_from_file() -> Result<String, io::Error> {
username_file.read_to_string(&mut username)?;
Ok(username)
}

fn read_username_from_file_simplified() -> Result<String, io::Error>{
let mut username = String::new();
File::open("hello.txt")?.read_to_string(&mut username)?;
Ok(username)
}

0 comments on commit a2483d2

Please sign in to comment.