From 65c9a1ab93b770ca476a7c6917ba0a314c3fc739 Mon Sep 17 00:00:00 2001 From: Daniel Martinez Maqueda Date: Wed, 3 Aug 2022 15:24:42 +0200 Subject: [PATCH] Fix cargo fmt --- src/compute/like.rs | 11 ++++++++--- tests/it/compute/like.rs | 1 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/compute/like.rs b/src/compute/like.rs index a41331dce84..bf363972a1a 100644 --- a/src/compute/like.rs +++ b/src/compute/like.rs @@ -39,7 +39,6 @@ fn replace_pattern(pattern: &str) -> String { result.push('\\'); result.push('\\'); } - } } else if regex_syntax::is_meta_character(c) { result.push('\\'); @@ -142,7 +141,10 @@ fn a_like_utf8_scalar bool>( let values = if !rhs.contains(is_like_pattern) { Bitmap::from_trusted_len_iter(lhs.values_iter().map(|x| op(x == rhs))) - } else if rhs.ends_with('%') && !rhs.ends_with("\\%") && !rhs[..rhs.len() - 1].contains(is_like_pattern) { + } else if rhs.ends_with('%') + && !rhs.ends_with("\\%") + && !rhs[..rhs.len() - 1].contains(is_like_pattern) + { // fast path, can use starts_with let starts_with = &rhs[..rhs.len() - 1]; Bitmap::from_trusted_len_iter(lhs.values_iter().map(|x| op(x.starts_with(starts_with)))) @@ -294,7 +296,10 @@ fn a_like_binary_scalar bool>( let values = if !pattern.contains(is_like_pattern) { Bitmap::from_trusted_len_iter(lhs.values_iter().map(|x| op(x == rhs))) - } else if pattern.ends_with('%') && !pattern.ends_with("\\%") && !pattern[..pattern.len() - 1].contains(is_like_pattern) { + } else if pattern.ends_with('%') + && !pattern.ends_with("\\%") + && !pattern[..pattern.len() - 1].contains(is_like_pattern) + { // fast path, can use starts_with let starts_with = &rhs[..rhs.len() - 1]; Bitmap::from_trusted_len_iter(lhs.values_iter().map(|x| op(x.starts_with(starts_with)))) diff --git a/tests/it/compute/like.rs b/tests/it/compute/like.rs index 078ebd0bcda..3bd4c6aaf3d 100644 --- a/tests/it/compute/like.rs +++ b/tests/it/compute/like.rs @@ -58,7 +58,6 @@ fn test_like_utf8_scalar() -> Result<()> { let result = like_utf8_scalar(&array, "A\\_row").unwrap(); assert_eq!(result, BooleanArray::from_slice(&[true, false])); - Ok(()) }