1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-05-16 23:55:42 +02:00

It makes no sense to use both return and ?.

This commit is contained in:
Andrew Walbran 2023-01-16 17:39:16 +00:00
parent 52d28b155b
commit 9fa0e89e90

View File

@ -23,7 +23,7 @@ fn read_username(path: &str) -> Result<String> {
.read_to_string(&mut username)
.context("Failed to read")?;
if username.is_empty() {
return Err(ReadUsernameError::EmptyUsername(String::from(path)))?;
return Err(ReadUsernameError::EmptyUsername(String::from(path)).into());
}
Ok(username)
}