Des unwrap qui se baladent et des expect
C'est dommage d'avoir pas gérer les erreurs proprement avec des Résult, au moins ça permet de choisir quoi faire au niveau du main ce qui est vachement plus pratique que d'avoir des crash tout au fond de la pile d'appel. :)
(rg c'est ripgrep un grep en rapide, en rust)
rg unwrap
main.rs
93: let docs_i = YamlLoader::load_from_str(&i).unwrap();
97: emitter_i.dump(doc_i).unwrap(); // dump the YAML object to a String
107: let docs = YamlLoader::load_from_str(&histoire).unwrap();
120: emitter.dump(doc).unwrap(); // dump the YAML object to a String
121: let current: Current = typed_example(&out_str).unwrap();
301: let serialized_state = serde_yaml::to_string(&perso).unwrap();
317: let docs = YamlLoader::load_from_str(&sauvegarde).unwrap();
321: emitter.dump(doc).unwrap();
rg expect
main.rs
92: /* let i = fs::read_to_string("image").expect("Something went wrong reading the file");
295: if let Event::Key(key) = event::read().expect("error") {
316: .expect("Something went wrong reading the file");
322: let p: Perso = serde_yaml::from_str(&resulta).expect("error");
Modification effectuée par Axel Viala