mirror of
https://github.com/rust-lang/book.git
synced 2026-04-02 05:54:06 -04:00
fix: ch10-03 - misleading use of expect on .split
This commit is contained in:
@@ -4,7 +4,7 @@ struct ImportantExcerpt<'a> {
|
||||
|
||||
fn main() {
|
||||
let novel = String::from("Call me Ishmael. Some years ago...");
|
||||
let first_sentence = novel.split('.').next().expect("Could not find a '.'");
|
||||
let first_sentence = novel.split('.').next().unwrap();
|
||||
let i = ImportantExcerpt {
|
||||
part: first_sentence,
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ impl<'a> ImportantExcerpt<'a> {
|
||||
|
||||
fn main() {
|
||||
let novel = String::from("Call me Ishmael. Some years ago...");
|
||||
let first_sentence = novel.split('.').next().expect("Could not find a '.'");
|
||||
let first_sentence = novel.split('.').next().unwrap();
|
||||
let i = ImportantExcerpt {
|
||||
part: first_sentence,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user