1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-02-04 10:09:29 +02:00

Consistently use err for the error value (#599)

This commit is contained in:
Martin Geisler 2023-04-27 10:10:49 -07:00 committed by GitHub
parent 274f16b839
commit c0d03bd86b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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),
}
}