Skip to content

Commit e75fe2c

Browse files
authored
Merge pull request #3939 from florian-trehaut/main
fix: ch10-03 - misleading use of expect on .split
2 parents 85442a6 + e551b7f commit e75fe2c

File tree

2 files changed

+2
-2
lines changed
  • listings/ch10-generic-types-traits-and-lifetimes

2 files changed

+2
-2
lines changed

listings/ch10-generic-types-traits-and-lifetimes/listing-10-24/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ struct ImportantExcerpt<'a> {
44

55
fn main() {
66
let novel = String::from("Call me Ishmael. Some years ago...");
7-
let first_sentence = novel.split('.').next().expect("Could not find a '.'");
7+
let first_sentence = novel.split('.').next().unwrap();
88
let i = ImportantExcerpt {
99
part: first_sentence,
1010
};

listings/ch10-generic-types-traits-and-lifetimes/no-listing-10-lifetimes-on-methods/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl<'a> ImportantExcerpt<'a> {
2121

2222
fn main() {
2323
let novel = String::from("Call me Ishmael. Some years ago...");
24-
let first_sentence = novel.split('.').next().expect("Could not find a '.'");
24+
let first_sentence = novel.split('.').next().unwrap();
2525
let i = ImportantExcerpt {
2626
part: first_sentence,
2727
};

0 commit comments

Comments
 (0)