diff --git a/src/source.rs b/src/source.rs index 1376cd0..cd0af90 100644 --- a/src/source.rs +++ b/src/source.rs @@ -101,8 +101,6 @@ enum GetVMTError{ Bsp(#[from]vbsp::BspError), #[error("Utf8 error {0:?}")] Utf8(#[from]std::str::Utf8Error), - #[error("FromUtf8 error {0:?}")] - FromUtf8(#[from]std::string::FromUtf8Error), #[error("Vdf error {0:?}")] Vdf(#[from]vmt_parser::VdfError), #[error("Vmt not found")] @@ -110,14 +108,11 @@ enum GetVMTError{ } fn get_vmt(finder:BspFinder,search_name:&str)->Result<vmt_parser::material::Material,GetVMTError>{ - let stuff=finder.find(search_name)?.ok_or(GetVMTError::NotFound)?; + let vmt_data=finder.find(search_name)?.ok_or(GetVMTError::NotFound)?; //decode vmt and then write - let stuff=match stuff{ - Cow::Borrowed(b)=>Cow::Borrowed(core::str::from_utf8(b)?), - Cow::Owned(b)=>Cow::Owned(String::from_utf8(b)?), - }; - let material=vmt_parser::from_str(stuff.as_ref())?; - println!("vmt material={:?}",material); + let vmt_str=core::str::from_utf8(&vmt_data)?; + let material=vmt_parser::from_str(vmt_str)?; + //println!("vmt material={:?}",material); Ok(material) }