mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-17 08:02:38 +02:00
It makes no sense to use both return and ?.
This commit is contained in:
parent
52d28b155b
commit
9fa0e89e90
@ -23,7 +23,7 @@ fn read_username(path: &str) -> Result<String> {
|
|||||||
.read_to_string(&mut username)
|
.read_to_string(&mut username)
|
||||||
.context("Failed to read")?;
|
.context("Failed to read")?;
|
||||||
if username.is_empty() {
|
if username.is_empty() {
|
||||||
return Err(ReadUsernameError::EmptyUsername(String::from(path)))?;
|
return Err(ReadUsernameError::EmptyUsername(String::from(path)).into());
|
||||||
}
|
}
|
||||||
Ok(username)
|
Ok(username)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user