removed some warnings

This commit is contained in:
MrDulfin 2023-12-11 13:16:12 -05:00
parent 4b55c2eaa8
commit 7e041bddd0

View file

@ -4,7 +4,6 @@ use quick_xml::events::Event;
use quick_xml::reader::Reader; use quick_xml::reader::Reader;
use std::collections::{BTreeMap, HashMap}; use std::collections::{BTreeMap, HashMap};
use std::fs::File; use std::fs::File;
use std::io::Error;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::str::FromStr; use std::str::FromStr;
use std::time::Duration as StdDur; use std::time::Duration as StdDur;
@ -107,7 +106,6 @@ impl ExternalLibrary for XmlLibrary {
panic!("Key not selected?!") panic!("Key not selected?!")
} }
} }
_ => panic!("WHAT DID YOU JUST DO?!🐰🐰🐰🐰"),
} }
} }
Err(e) => panic!("Error at position {}: {:?}", reader.buffer_position(), e), Err(e) => panic!("Error at position {}: {:?}", reader.buffer_position(), e),
@ -323,34 +321,34 @@ impl XMLSong {
} }
} }
fn get_folder(file: &PathBuf) -> String { // fn get_folder(file: &PathBuf) -> String {
let mut reader = Reader::from_file(file).unwrap(); // let mut reader = Reader::from_file(file).unwrap();
reader.trim_text(true); // reader.trim_text(true);
//count every event, for fun ig? // //count every event, for fun ig?
let mut count = 0; // let mut count = 0;
let mut buf = Vec::new(); // let mut buf = Vec::new();
let mut folder = String::new(); // let mut folder = String::new();
loop { // loop {
match reader.read_event_into(&mut buf) { // match reader.read_event_into(&mut buf) {
Ok(Event::Start(_)) => { // Ok(Event::Start(_)) => {
count += 1; // count += 1;
} // }
Ok(Event::Text(e)) => { // Ok(Event::Text(e)) => {
if count == 10 { // if count == 10 {
folder = String::from( // folder = String::from(
e.unescape() // e.unescape()
.unwrap() // .unwrap()
.to_string() // .to_string()
.strip_prefix("file://localhost/") // .strip_prefix("file://localhost/")
.unwrap(), // .unwrap(),
); // );
return folder; // return folder;
} // }
} // }
Err(_e) => { // Err(_e) => {
panic!("oh no! something happened in the public function `get_reader_from_xml()!`") // panic!("oh no! something happened in the public function `get_reader_from_xml()!`")
} // }
_ => (), // _ => (),
} // }
} // }
} // }