Skip to content

Commit

Permalink
Consistently use err for the error value (google#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeisler authored Apr 27, 2023
1 parent 274f16b commit c0d03bd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/error-handling/try-operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ use std::io::{self, Read};
fn read_username(path: &str) -> Result<String, io::Error> {
let username_file_result = fs::File::open(path);
let mut username_file = match username_file_result {
Ok(file) => file,
Err(e) => return Err(e),
Err(err) => return Err(err),
};
let mut username = String::new();
match username_file.read_to_string(&mut username) {
Ok(_) => Ok(username),
Err(e) => Err(e),
Err(err) => Err(err),
}
}
Expand Down

0 comments on commit c0d03bd

Please sign in to comment.