more optimize

This commit is contained in:
vms 2019-08-18 18:19:35 +02:00
parent b2fdcd889e
commit 3b1d45a4d7
2 changed files with 14 additions and 22 deletions

View File

@ -5,15 +5,11 @@ pub fn query(bytes: &str) -> AppResult<String> {
let response = sqlite::call(bytes.as_bytes());
// Decode query result to a utf8 string
match String::from_utf8(response) {
Ok(string) => Ok(string),
Err(err) => {
log::error!("unable to decode result from bytes: {:#x?}", bytes);
Err(err_msg(&format!(
"unable to decode result from bytes {:#x?}: {}",
bytes, err
)))
}
}
String::from_utf8(response).map_err(|e| {
log::error!("unable to decode result from bytes: {:#x?}", bytes);
err_msg(&format!(
"unable to decode result from bytes {:#x?}: {}",
bytes, e
))
})
}

View File

@ -5,15 +5,11 @@ pub fn query(bytes: &str) -> AppResult<String> {
let response = sqlite::call(bytes.as_bytes());
// Decode query result to a utf8 string
match String::from_utf8(response) {
Ok(string) => Ok(string),
Err(err) => {
log::error!("unable to decode result from bytes: {:#x?}", bytes);
Err(err_msg(&format!(
"unable to decode result from bytes {:#x?}: {}",
bytes, err
)))
}
}
String::from_utf8(response).map_err(|e| {
log::error!("unable to decode result from bytes: {:#x?}", bytes);
err_msg(&format!(
"unable to decode result from bytes {:#x?}: {}",
bytes, e
))
})
}