1
0
Fork 0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-05-12 01:06:08 +02:00

Remove confusing aside in 23_conversions/from_str.rs

The advice tell us how to return as String error message. Unless I missed something, we can't even return a String error message here, so this advice is more confusing than anything and should better be removed.
This commit is contained in:
NicolasRoelandt 2023-12-08 17:52:21 +00:00 committed by GitHub
parent 88b583f2bb
commit f35f63fa57
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,10 +44,6 @@ enum ParsePersonError {
// 6. If while extracting the name and the age something goes wrong, an error
// should be returned
// If everything goes well, then return a Result of a Person object
//
// As an aside: `Box<dyn Error>` implements `From<&'_ str>`. This means that if
// you want to return a string error message, you can do so via just using
// return `Err("my error message".into())`.
impl FromStr for Person {
type Err = ParsePersonError;