fix: resolve clippy warnings and missing struct fields in tests
This commit is contained in:
1 parent
5f870be0d9
commit
c57e18bf3e
17 files changed
+49
-30
No files matched your search
@@ -429,10 +429,7 @@ fn elasticsearch_query_from_document_filter(filter: Option<&str>) -> Result<Opti
|
||||
};
|
||||
let value: serde_json::Value = serde_json::from_str(filter).map_err(|e| format!("Invalid filter JSON: {e}"))?;
|
||||
let query = translate_document_filter_value(&value)?;
|
||||
Ok(match query {
|
||||
Some(query) => Some(query),
|
||||
None => None,
|
||||
})
|
||||
Ok(query)
|
||||
}
|
||||
|
||||
fn translate_document_filter_value(value: &serde_json::Value) -> Result<Option<serde_json::Value>, String> {
|
||||
|
||||
@@ -2160,7 +2160,7 @@ mod tests {
|
||||
let escaped = pg_quote_ident(malicious);
|
||||
// Double quotes should be doubled, not breaking out
|
||||
assert_eq!(escaped, r#""public""; DROP TABLE users; --""#);
|
||||
assert!(escaped.matches('"').count() % 2 == 0, "quote count should be even");
|
||||
assert!(escaped.matches('"').count().is_multiple_of(2), "quote count should be even");
|
||||
}
|
||||
|
||||
// --- query_result_row_limit ---
|
||||
@@ -2479,14 +2479,14 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn execute_batch_whitespace_only_is_filtered() {
|
||||
let statements = vec![" ".to_string(), "\t\n".to_string(), "".to_string()];
|
||||
let statements = [" ".to_string(), "\t\n".to_string(), "".to_string()];
|
||||
let combined = statements.iter().map(|s| s.trim()).filter(|s| !s.is_empty()).collect::<Vec<_>>().join(";\n");
|
||||
assert!(combined.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn execute_batch_joins_with_semicolons() {
|
||||
let statements = vec!["SELECT 1".to_string(), "SELECT 2".to_string()];
|
||||
let statements = ["SELECT 1".to_string(), "SELECT 2".to_string()];
|
||||
let combined = statements.iter().map(|s| s.trim()).filter(|s| !s.is_empty()).collect::<Vec<_>>().join(";\n");
|
||||
assert_eq!(combined, "SELECT 1;\nSELECT 2");
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ fn ssh_client_config() -> Config {
|
||||
Config { nodelay: true, keepalive_interval: Some(Duration::from_secs(30)), preferred, ..Default::default() }
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn connect_and_authenticate(
|
||||
ssh_host: &str,
|
||||
ssh_port: u16,
|
||||
|
||||
Reference in new issue
Block a user