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:
parent
274f16b839
commit
c0d03bd86b
@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user