chore: resolve clippy warnings for pre-push audit
This commit is contained in:
1 parent
bd20482cea
commit
03f8786d24
7 files changed
+19
-23
No files matched your search
@@ -2551,10 +2551,7 @@ mod tests {
|
|||||||
rmpv_to_json(&rmpv::Value::Integer(42.into())),
|
rmpv_to_json(&rmpv::Value::Integer(42.into())),
|
||||||
serde_json::json!(42)
|
serde_json::json!(42)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(rmpv_to_json(&rmpv::Value::F64(3.5)), serde_json::json!(3.5));
|
||||||
rmpv_to_json(&rmpv::Value::F64(3.14)),
|
|
||||||
serde_json::json!(3.14)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
rmpv_to_json(&rmpv::Value::String("hello".into())),
|
rmpv_to_json(&rmpv::Value::String("hello".into())),
|
||||||
serde_json::json!("hello")
|
serde_json::json!("hello")
|
||||||
|
|||||||
@@ -295,10 +295,9 @@ mod tests {
|
|||||||
.iter()
|
.iter()
|
||||||
.filter_map(|act_val| {
|
.filter_map(|act_val| {
|
||||||
if act_val["category"] == "TASK_EVENT" {
|
if act_val["category"] == "TASK_EVENT" {
|
||||||
if let Some(details_str) = act_val["details"].as_str() {
|
let details_str = act_val["details"].as_str()?;
|
||||||
if let Ok(event_val) =
|
let event_val =
|
||||||
serde_json::from_str::<serde_json::Value>(details_str)
|
serde_json::from_str::<serde_json::Value>(details_str).ok()?;
|
||||||
{
|
|
||||||
return Some(
|
return Some(
|
||||||
serde_json::json!({
|
serde_json::json!({
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
@@ -308,8 +307,6 @@ mod tests {
|
|||||||
.to_string(),
|
.to_string(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
None
|
None
|
||||||
})
|
})
|
||||||
.take(5)
|
.take(5)
|
||||||
|
|||||||
+5
-4
@@ -808,7 +808,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cli_parsing_default() {
|
fn test_cli_parsing_default() {
|
||||||
let cli = Cli::try_parse_from(&["mcp-memory-server"]).unwrap();
|
let cli = Cli::try_parse_from(["mcp-memory-server"]).unwrap();
|
||||||
assert!(cli.command.is_none());
|
assert!(cli.command.is_none());
|
||||||
assert!(!cli.exit);
|
assert!(!cli.exit);
|
||||||
assert!(!cli.restart);
|
assert!(!cli.restart);
|
||||||
@@ -816,7 +816,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cli_parsing_exit_and_target() {
|
fn test_cli_parsing_exit_and_target() {
|
||||||
let cli = Cli::try_parse_from(&[
|
let cli = Cli::try_parse_from([
|
||||||
"mcp-memory-server",
|
"mcp-memory-server",
|
||||||
"--exit",
|
"--exit",
|
||||||
"--target",
|
"--target",
|
||||||
@@ -829,7 +829,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cli_parsing_gate_set() {
|
fn test_cli_parsing_gate_set() {
|
||||||
let cli = Cli::try_parse_from(&[
|
let cli = Cli::try_parse_from([
|
||||||
"mcp-memory-server",
|
"mcp-memory-server",
|
||||||
"gate",
|
"gate",
|
||||||
"set",
|
"set",
|
||||||
@@ -865,7 +865,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cli_parsing_gate_verify() {
|
fn test_cli_parsing_gate_verify() {
|
||||||
let cli = Cli::try_parse_from(&[
|
let cli = Cli::try_parse_from([
|
||||||
"mcp-memory-server",
|
"mcp-memory-server",
|
||||||
"gate",
|
"gate",
|
||||||
"verify",
|
"verify",
|
||||||
@@ -930,6 +930,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[allow(clippy::await_holding_lock)]
|
||||||
async fn test_run_server_graceful_shutdown() {
|
async fn test_run_server_graceful_shutdown() {
|
||||||
let _lock = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
|
let _lock = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
|
||||||
let temp_dir = tempfile::tempdir().unwrap();
|
let temp_dir = tempfile::tempdir().unwrap();
|
||||||
|
|||||||
@@ -1398,7 +1398,7 @@ mod tests {
|
|||||||
let handler = MemoryHandler::new(state);
|
let handler = MemoryHandler::new(state);
|
||||||
|
|
||||||
// 1. Verify invalid LLM requests fail gracefully with isError: true or structured response
|
// 1. Verify invalid LLM requests fail gracefully with isError: true or structured response
|
||||||
for (tool_name, _tool) in &handler.tools {
|
for tool_name in handler.tools.keys() {
|
||||||
let invalid_req = json!({
|
let invalid_req = json!({
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"id": 200,
|
"id": 200,
|
||||||
|
|||||||
+1
-2
@@ -1,5 +1,6 @@
|
|||||||
use crate::models::*;
|
use crate::models::*;
|
||||||
use crate::search::MemoryIndex;
|
use crate::search::MemoryIndex;
|
||||||
|
pub use crate::search::{SearchResult as UnifiedSearchResult, SearchService};
|
||||||
use crate::store::Store;
|
use crate::store::Store;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@@ -575,5 +576,3 @@ mod tests {
|
|||||||
assert!(activities_updated[0].timestamp >= activities_updated[1].timestamp);
|
assert!(activities_updated[0].timestamp >= activities_updated[1].timestamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub use crate::search::{SearchResult as UnifiedSearchResult, SearchService};
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
use image::DynamicImage;
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_img() {
|
fn test_img() {
|
||||||
let mut img = image::DynamicImage::new_rgb8(10, 10);
|
let mut img = image::DynamicImage::new_rgb8(10, 10);
|
||||||
img.invert();
|
img.invert();
|
||||||
let img2 = img.adjust_contrast(20.0);
|
let _img2 = img.adjust_contrast(20.0);
|
||||||
}
|
}
|
||||||
@@ -101,9 +101,10 @@ fn test_dashboard_route_parity() {
|
|||||||
let mut registered_routes = HashSet::new();
|
let mut registered_routes = HashSet::new();
|
||||||
for part in setup_content.split(".route(") {
|
for part in setup_content.split(".route(") {
|
||||||
let trimmed = part.trim_start();
|
let trimmed = part.trim_start();
|
||||||
if trimmed.starts_with('"') {
|
#[allow(clippy::collapsible_if)]
|
||||||
if let Some(end_quote) = trimmed[1..].find('"') {
|
if let Some(stripped) = trimmed.strip_prefix('"') {
|
||||||
let route = &trimmed[1..=end_quote];
|
if let Some(end_quote) = stripped.find('"') {
|
||||||
|
let route = &stripped[..end_quote];
|
||||||
registered_routes.insert(route.to_string());
|
registered_routes.insert(route.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,8 +120,10 @@ fn test_dashboard_route_parity() {
|
|||||||
let rest = &dashboard_content[start..];
|
let rest = &dashboard_content[start..];
|
||||||
let quote_char = dashboard_content[..start].chars().last();
|
let quote_char = dashboard_content[..start].chars().last();
|
||||||
let mut endpoint = String::new();
|
let mut endpoint = String::new();
|
||||||
|
#[allow(clippy::collapsible_if)]
|
||||||
if let Some(q) = quote_char {
|
if let Some(q) = quote_char {
|
||||||
if q == '`' || q == '"' || q == '\'' {
|
let is_quote = q == '`' || q == '"' || q == '\'';
|
||||||
|
if is_quote {
|
||||||
if let Some(close_idx) = rest.find(q) {
|
if let Some(close_idx) = rest.find(q) {
|
||||||
let full_call = &rest[..close_idx];
|
let full_call = &rest[..close_idx];
|
||||||
let clean = if let Some(q_idx) = full_call.find('?') {
|
let clean = if let Some(q_idx) = full_call.find('?') {
|
||||||
|
|||||||
Reference in new issue
Block a user