diff --git a/libclamav_rust/src/ctx.rs b/libclamav_rust/src/ctx.rs
index e988238241..275eaf0937 100644
--- a/libclamav_rust/src/ctx.rs
+++ b/libclamav_rust/src/ctx.rs
@@ -20,15 +20,11 @@
* MA 02110-1301, USA.
*/
-use std::convert::TryInto;
-use std::path::{PathBuf};
-use std::slice;
+use std::{convert::TryInto, path::PathBuf, slice};
use thiserror;
-use crate::fmap::FMap;
-use crate::sys::cli_ctx;
-use crate::util::str_from_ptr;
+use crate::{fmap::FMap, sys::cli_ctx, util::str_from_ptr};
/// Error enumerates all possible errors returned by this library.
#[derive(thiserror::Error, Debug)]
@@ -48,8 +44,8 @@ pub enum Error {
#[error("Invalid FMap")]
BadMap,
- #[error("File path is not valid UTF8")]
- FilepathNotUtf8,
+ #[error("String not UTF8: {0}")]
+ Utf8(#[from] std::str::Utf8Error),
}
/// Get the ctx.sub_filepath as an Option<'str>
@@ -63,7 +59,7 @@ pub unsafe fn sub_filepath(ctx: *mut cli_ctx) -> Result