Skip to content

Commit d2a1974

Browse files
committed
revert: clippy and/or format changes that have nothing to do with the PR
1 parent 94970f7 commit d2a1974

File tree

4 files changed

+33
-20
lines changed

4 files changed

+33
-20
lines changed

datadog-sidecar-macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
use proc_macro::TokenStream;
55
use quote::{format_ident, quote};
6+
use syn::FnArg::Typed;
67
use syn::__private::Span;
78
use syn::parse::{Parse, ParseStream};
8-
use syn::FnArg::Typed;
99
use syn::{parse_macro_input, parse_quote, Arm, Ident, ItemTrait, Pat, TraitItem};
1010

1111
fn snake_to_camel(ident_str: &str) -> String {

libdd-common-ffi/src/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ mod tests {
181181
let vec = vec![0, 2, 4, 6];
182182
let ffi_vec: Vec<u8> = Vec::from(vec.clone());
183183

184-
for (a, b) in vec.iter().zip(&ffi_vec) {
184+
for (a, b) in vec.iter().zip(ffi_vec.into_iter()) {
185185
assert_eq!(a, b)
186186
}
187187
}

libdd-trace-obfuscation/src/redis.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,27 +94,29 @@ fn obfuscate_redis_cmd<'a>(str: &mut String, cmd: &'a str, mut args: Vec<&'a str
9494
let mut uppercase_cmd = [0; 32]; // no redis cmd is longer than 32 chars
9595
let uppercase_cmd = ascii_uppercase(cmd, &mut uppercase_cmd).unwrap_or(&[]);
9696
match uppercase_cmd {
97-
b"AUTH" | b"MIGRATE" | b"HELLO"
97+
b"AUTH" | b"MIGRATE" | b"HELLO" => {
9898
// Obfuscate everything after command:
9999
// • AUTH password
100100
// • MIGRATE host port key|"" destination-db timeout [COPY] [REPLACE] [AUTH password]
101101
// [AUTH2 username password] [KEYS key [key ...]]
102102
// • HELLO [protover [AUTH username password] [SETNAME clientname]]
103-
if !args.is_empty() => {
103+
if !args.is_empty() {
104104
args.clear();
105105
args.push("?");
106106
}
107-
b"ACL"
107+
}
108+
b"ACL" => {
108109
// Obfuscate all arguments after the subcommand:
109110
// • ACL SETUSER username on >password ~keys &channels +commands
110111
// • ACL GETUSER username
111112
// • ACL DELUSER username [username ...]
112113
// • ACL LIST
113114
// • ACL WHOAMI
114-
if args.len() > 1 => {
115+
if args.len() > 1 {
115116
args[1] = "?";
116117
args.drain(2..);
117118
}
119+
}
118120
b"APPEND" | b"GETSET" | b"LPUSHX" | b"GEORADIUSBYMEMBER" | b"RPUSHX" | b"SET"
119121
| b"SETNX" | b"SISMEMBER" | b"ZRANK" | b"ZREVRANK" | b"ZSCORE" => {
120122
// Obfuscate 2nd argument:
@@ -153,7 +155,7 @@ fn obfuscate_redis_cmd<'a>(str: &mut String, cmd: &'a str, mut args: Vec<&'a str
153155
// • LINSERT key BEFORE|AFTER pivot value
154156
args = obfuscate_redis_args_n(args, 3);
155157
}
156-
b"GEOHASH" | b"GEOPOS" | b"GEODIST" | b"LPUSH" | b"RPUSH" | b"SREM" | b"ZREM" | b"SADD"
158+
b"GEOHASH" | b"GEOPOS" | b"GEODIST" | b"LPUSH" | b"RPUSH" | b"SREM" | b"ZREM" | b"SADD" => {
157159
// Obfuscate all arguments after the first one.
158160
// • GEOHASH key member [member ...]
159161
// • GEOPOS key member [member ...]
@@ -163,10 +165,11 @@ fn obfuscate_redis_cmd<'a>(str: &mut String, cmd: &'a str, mut args: Vec<&'a str
163165
// • SREM key member [member ...]
164166
// • ZREM key member [member ...]
165167
// • SADD key member [member ...]
166-
if args.len() > 1 => {
168+
if args.len() > 1 {
167169
args[1] = "?";
168170
args.drain(2..);
169171
}
172+
}
170173
b"GEOADD" => {
171174
// Obfuscating every 3rd argument starting from first
172175
// • GEOADD key longitude latitude member [longitude latitude member ...]

libdd-trace-obfuscation/src/redis_tokenizer.rs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,30 @@ impl<'a> RedisTokenizer<'a> {
8686
loop {
8787
match self.curr_char() {
8888
0 => break,
89-
b'\\' if !escape => {
90-
escape = true;
91-
self.offset += 1;
92-
continue;
89+
b'\\' => {
90+
if !escape {
91+
escape = true;
92+
self.offset += 1;
93+
continue;
94+
}
9395
}
94-
b'"' if !escape => quote = !quote,
95-
b'\n' if !quote => {
96-
let span = (start, self.offset);
97-
self.offset += 1;
98-
self.state = RedisTokenType::RedisTokenCommand;
99-
return span;
96+
b'"' => {
97+
if !escape {
98+
quote = !quote
99+
}
100100
}
101-
b' ' if !quote => {
102-
return (start, self.offset);
101+
b'\n' => {
102+
if !quote {
103+
let span = (start, self.offset);
104+
self.offset += 1;
105+
self.state = RedisTokenType::RedisTokenCommand;
106+
return span;
107+
}
108+
}
109+
b' ' => {
110+
if !quote {
111+
return (start, self.offset);
112+
}
103113
}
104114
_ => {}
105115
}

0 commit comments

Comments
 (0)