mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-19 17:03:13 +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() {
|
fn main() {
|
||||||
//fs::write("config.dat", "").unwrap();
|
//fs::write("config.dat", "").unwrap();
|
||||||
let username = read_username("config.dat");
|
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() {
|
fn main() {
|
||||||
//fs::write("config.dat", "alice").unwrap();
|
//fs::write("config.dat", "alice").unwrap();
|
||||||
let username = read_username("config.dat");
|
let username = read_username("config.dat");
|
||||||
println!("username: {username:?}");
|
println!("username or error: {username:?}");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user