commit ce510f3169fabd3a7862b2d64be599583b7bf622 parent b6ca4466caa215f930a9d3c550dc215472169a86 Author: tomvig38@gmail.com <tomvig38@gmail.com> Date: Fri, 15 Oct 2021 14:23:18 +0000 Malpliigu uzoj de unwrap Diffstat:
M | src/main.rs | | | 6 | +++--- |
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main.rs b/src/main.rs @@ -173,10 +173,10 @@ fn define_word(word: &str) -> Option<String> { }, word.to_owned(), ) { - let t = &defs.get(0).unwrap().text; - let d = ParsedDefinition::new(t); + let t = defs.get(0)?; + let d = ParsedDefinition::new(&t.text); println!("{:?}", d); - Some(String::from(d.definitions.get(0).unwrap())) + Some(String::from(d.definitions.get(0)?)) } else { None }