mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-02-04 10:09:29 +02:00
Merge pull request #123 from ilyagr/username_or_error
Error handling: clarify printing of Result
This commit is contained in:
commit
e29c3bfb99
@ -46,6 +46,6 @@ fn read_username(path: &str) -> Result<String, ReadUsernameError> {
|
||||
fn main() {
|
||||
//fs::write("config.dat", "").unwrap();
|
||||
let username = read_username("config.dat");
|
||||
println!("username: {username:?}");
|
||||
println!("username or error: {username:?}");
|
||||
}
|
||||
```
|
||||
|
@ -41,6 +41,6 @@ fn read_username(path: &str) -> Result<String, io::Error> {
|
||||
fn main() {
|
||||
//fs::write("config.dat", "alice").unwrap();
|
||||
let username = read_username("config.dat");
|
||||
println!("username: {username:?}");
|
||||
println!("username or error: {username:?}");
|
||||
}
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user