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())),
|
||||
serde_json::json!(42)
|
||||
);
|
||||
assert_eq!(
|
||||
rmpv_to_json(&rmpv::Value::F64(3.14)),
|
||||
serde_json::json!(3.14)
|
||||
);
|
||||
assert_eq!(rmpv_to_json(&rmpv::Value::F64(3.5)), serde_json::json!(3.5));
|
||||
assert_eq!(
|
||||
rmpv_to_json(&rmpv::Value::String("hello".into())),
|
||||
serde_json::json!("hello")
|
||||
|
||||
@@ -295,10 +295,9 @@ mod tests {
|
||||
.iter()
|
||||
.filter_map(|act_val| {
|
||||
if act_val["category"] == "TASK_EVENT" {
|
||||
if let Some(details_str) = act_val["details"].as_str() {
|
||||
if let Ok(event_val) =
|
||||
serde_json::from_str::<serde_json::Value>(details_str)
|
||||
{
|
||||
let details_str = act_val["details"].as_str()?;
|
||||
let event_val =
|
||||
serde_json::from_str::<serde_json::Value>(details_str).ok()?;
|
||||
return Some(
|
||||
serde_json::json!({
|
||||
"jsonrpc": "2.0",
|
||||
@@ -308,8 +307,6 @@ mod tests {
|
||||
.to_string(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
})
|
||||
.take(5)
|
||||
|
||||
+5
-4
@@ -808,7 +808,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
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.exit);
|
||||
assert!(!cli.restart);
|
||||
@@ -816,7 +816,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_cli_parsing_exit_and_target() {
|
||||
let cli = Cli::try_parse_from(&[
|
||||
let cli = Cli::try_parse_from([
|
||||
"mcp-memory-server",
|
||||
"--exit",
|
||||
"--target",
|
||||
@@ -829,7 +829,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_cli_parsing_gate_set() {
|
||||
let cli = Cli::try_parse_from(&[
|
||||
let cli = Cli::try_parse_from([
|
||||
"mcp-memory-server",
|
||||
"gate",
|
||||
"set",
|
||||
@@ -865,7 +865,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_cli_parsing_gate_verify() {
|
||||
let cli = Cli::try_parse_from(&[
|
||||
let cli = Cli::try_parse_from([
|
||||
"mcp-memory-server",
|
||||
"gate",
|
||||
"verify",
|
||||
@@ -930,6 +930,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[allow(clippy::await_holding_lock)]
|
||||
async fn test_run_server_graceful_shutdown() {
|
||||
let _lock = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
|
||||
let temp_dir = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -1398,7 +1398,7 @@ mod tests {
|
||||
let handler = MemoryHandler::new(state);
|
||||
|
||||
// 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!({
|
||||
"jsonrpc": "2.0",
|
||||
"id": 200,
|
||||
|
||||
+1
-2
@@ -1,5 +1,6 @@
|
||||
use crate::models::*;
|
||||
use crate::search::MemoryIndex;
|
||||
pub use crate::search::{SearchResult as UnifiedSearchResult, SearchService};
|
||||
use crate::store::Store;
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
@@ -575,5 +576,3 @@ mod tests {
|
||||
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]
|
||||
fn test_img() {
|
||||
let mut img = image::DynamicImage::new_rgb8(10, 10);
|
||||
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();
|
||||
for part in setup_content.split(".route(") {
|
||||
let trimmed = part.trim_start();
|
||||
if trimmed.starts_with('"') {
|
||||
if let Some(end_quote) = trimmed[1..].find('"') {
|
||||
let route = &trimmed[1..=end_quote];
|
||||
#[allow(clippy::collapsible_if)]
|
||||
if let Some(stripped) = trimmed.strip_prefix('"') {
|
||||
if let Some(end_quote) = stripped.find('"') {
|
||||
let route = &stripped[..end_quote];
|
||||
registered_routes.insert(route.to_string());
|
||||
}
|
||||
}
|
||||
@@ -119,8 +120,10 @@ fn test_dashboard_route_parity() {
|
||||
let rest = &dashboard_content[start..];
|
||||
let quote_char = dashboard_content[..start].chars().last();
|
||||
let mut endpoint = String::new();
|
||||
#[allow(clippy::collapsible_if)]
|
||||
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) {
|
||||
let full_call = &rest[..close_idx];
|
||||
let clean = if let Some(q_idx) = full_call.find('?') {
|
||||
|
||||
Reference in new issue
Block a user