style(redis): 修正 Rust 格式检查

This commit is contained in:
Bacon2994 2026-05-08 10:11:44 +08:00
parent 0fb6aebd59
commit b669efb5ff
2 changed files with 8 additions and 15 deletions

View File

@ -139,7 +139,8 @@ pub async fn get_value(con: &mut redis::aio::MultiplexedConnection, key: &[u8])
(redis_raw_to_json(v), value_is_binary)
}
"list" => {
let v: RedisRawValue = redis::cmd("LRANGE").arg(key).arg(0).arg(-1).query_async(con).await.map_err(|e| e.to_string())?;
let v: RedisRawValue =
redis::cmd("LRANGE").arg(key).arg(0).arg(-1).query_async(con).await.map_err(|e| e.to_string())?;
(redis_array_to_json(v), false)
}
"set" => {
@ -368,9 +369,7 @@ pub fn redis_key_bytes_to_raw(bytes: &[u8]) -> String {
}
pub fn redis_key_raw_to_bytes(value: &str) -> Result<Vec<u8>, String> {
base64::engine::general_purpose::STANDARD
.decode(value)
.map_err(|e| format!("Invalid Redis key encoding: {e}"))
base64::engine::general_purpose::STANDARD.decode(value).map_err(|e| format!("Invalid Redis key encoding: {e}"))
}
pub async fn set_string(
@ -426,8 +425,8 @@ pub async fn set_remove(con: &mut redis::aio::MultiplexedConnection, key: &[u8],
#[cfg(test)]
mod tests {
use super::{
parse_database_count, parse_scan_keys, parse_stream_entries, redis_key_bytes_to_display, redis_key_bytes_to_raw,
redis_key_raw_to_bytes, redis_raw_to_json, RedisRawValue,
parse_database_count, parse_scan_keys, parse_stream_entries, redis_key_bytes_to_display,
redis_key_bytes_to_raw, redis_key_raw_to_bytes, redis_raw_to_json, RedisRawValue,
};
fn bulk(value: &str) -> RedisRawValue {

View File

@ -146,8 +146,8 @@ pub async fn hash_set(
&req.field,
value,
)
.await
.map_err(AppError)?;
.await
.map_err(AppError)?;
Ok(Json(()))
}
@ -197,13 +197,7 @@ pub async fn set_remove(
State(state): State<Arc<WebState>>,
Json(req): Json<RedisSetRequest>,
) -> Result<Json<()>, AppError> {
dbx_core::redis_ops::redis_set_remove_in_db_core(
&state.app,
&req.connection_id,
req.db,
&req.key_raw,
&req.member,
)
dbx_core::redis_ops::redis_set_remove_in_db_core(&state.app, &req.connection_id, req.db, &req.key_raw, &req.member)
.await
.map_err(AppError)?;
Ok(Json(()))