From c5a5aabe58959398e3d8ecd4675d644ce4f3cbf1 Mon Sep 17 00:00:00 2001 From: Abdulla Abdurakhmanov Date: Sun, 11 Aug 2024 19:47:28 +0200 Subject: [PATCH] Fix tests --- src/args.rs | 2 +- src/commands/copy_command.rs | 1 - src/redacters/aws_comprehend.rs | 4 ++-- src/redacters/gcp_dlp.rs | 4 ++-- src/redacters/gemini_llm.rs | 4 ++-- src/redacters/ms_presidio.rs | 4 ++-- src/redacters/open_ai_llm.rs | 4 ++-- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/args.rs b/src/args.rs index 61ee878..7495c88 100644 --- a/src/args.rs +++ b/src/args.rs @@ -158,7 +158,7 @@ impl TryInto for RedacterArgs { fn try_into(self) -> Result { let mut provider_options = Vec::with_capacity(self.redact.as_ref().map(Vec::len).unwrap_or(0)); - for options in self.redact.unwrap_or_else(Vec::new) { + for options in self.redact.unwrap_or_default() { let redacter_options = match options { RedacterType::GcpDlp => match self.gcp_project_id { Some(ref project_id) => { diff --git a/src/commands/copy_command.rs b/src/commands/copy_command.rs index e8a64df..faf6559 100644 --- a/src/commands/copy_command.rs +++ b/src/commands/copy_command.rs @@ -13,7 +13,6 @@ use futures::Stream; use gcloud_sdk::prost::bytes; use indicatif::*; use std::error::Error; -use std::fmt::Write; use std::time::Duration; pub struct CopyCommandResult { diff --git a/src/redacters/aws_comprehend.rs b/src/redacters/aws_comprehend.rs index 7ad072b..dd5bf73 100644 --- a/src/redacters/aws_comprehend.rs +++ b/src/redacters/aws_comprehend.rs @@ -139,8 +139,8 @@ mod tests { ) .await?; - let redacted_content = redacter.redact(input).await?; - match redacted_content { + let redacted_item = redacter.redact(input).await?; + match redacted_item.content { RedacterDataItemContent::Value(value) => { assert_eq!(value, "Hello, XXXX"); } diff --git a/src/redacters/gcp_dlp.rs b/src/redacters/gcp_dlp.rs index 910ea40..775ed86 100644 --- a/src/redacters/gcp_dlp.rs +++ b/src/redacters/gcp_dlp.rs @@ -399,8 +399,8 @@ mod tests { ) .await?; - let redacted_content = redacter.redact(input).await?; - match redacted_content { + let redacted_item = redacter.redact(input).await?; + match redacted_item.content { RedacterDataItemContent::Value(value) => { assert_eq!(value, "Hello, [REDACTED]"); } diff --git a/src/redacters/gemini_llm.rs b/src/redacters/gemini_llm.rs index 6c61f3d..42f39ed 100644 --- a/src/redacters/gemini_llm.rs +++ b/src/redacters/gemini_llm.rs @@ -228,8 +228,8 @@ mod tests { ) .await?; - let redacted_content = redacter.redact(input).await?; - match redacted_content { + let redacted_item = redacter.redact(input).await?; + match redacted_item.content { RedacterDataItemContent::Value(value) => { assert_eq!(value.trim(), "Hello, [REDACTED]"); } diff --git a/src/redacters/ms_presidio.rs b/src/redacters/ms_presidio.rs index 6a74f9b..72e69b3 100644 --- a/src/redacters/ms_presidio.rs +++ b/src/redacters/ms_presidio.rs @@ -251,8 +251,8 @@ mod tests { ) .await?; - let redacted_content = redacter.redact(input).await?; - match redacted_content { + let redacted_item = redacter.redact(input).await?; + match redacted_item.content { RedacterDataItemContent::Value(value) => { assert_eq!(value, "Hello, XXXX"); } diff --git a/src/redacters/open_ai_llm.rs b/src/redacters/open_ai_llm.rs index 03e907e..7af4b75 100644 --- a/src/redacters/open_ai_llm.rs +++ b/src/redacters/open_ai_llm.rs @@ -209,8 +209,8 @@ mod tests { ) .await?; - let redacted_content = redacter.redact(input).await?; - match redacted_content { + let redacted_item = redacter.redact(input).await?; + match redacted_item.content { RedacterDataItemContent::Value(value) => { assert_eq!(value.trim(), "Hello, [REDACTED]"); }